Tin oxide (SnO2) is regarded as a promising anode material for both lithium-ion batteries (LIBs) and sodium-ion batteries (SIBs) due to its large theoretical capacity. However, poor electrical conductivity and the weak cyclability resulted from dramatic volume expansion upon cycling process still hinder its practical application. Herein, we report a facile two-step hydrothermal route to encapsulate core–shell structured carbon nanotube (CNT)@SnO2 composite in a graphene coating with novel three-dimensional (3D) porous framework architecture (CNT@SnO2@G) as anode for both LIBs and SIBs. The resultant CNT@SnO2@G electrode suggests outstanding lithium and sodium storage performance with large specific capacity, remarkable cycling stability and excellent rate capability. For LIBs, it delivers a high initial discharge capacity of 1400mAhg−1 at 100mAg−1, improved reversible capacity of 947mAhg−1 after 100 cycles at 100mAg−1, and enhanced rate capability of 281mAhg−1 at 3000mAg−1. In addition, sodium storage testing suggests that a high discharge capacity of 323mAhg−1 after 100 cycles at 25mAg−1 was achieved. The present unique structural design associated with the remarkable lithium and sodium storage performance ensures CNT@SnO2@G as an advanced anode material for rechargeable LIBs and SIBs.