The practical application of Sn, a promising anode material for lithium-ion batteries, is hindered primarily by its huge volume change (up to 260%) upon lithiation. To tackle this obstacle, here we report a facile one-pot method, i.e., pyrolysis of a mixture of GO, SnCl4, and cyanamide at elevated temperatures to create in situ a novel mesoporous structure of Sn@N-doped graphene (Sn@NG). In the constructed architecture, the ultrasmall Sn nanoparticles (2–3 nm) are uniformly embedded in the NG network while the crumpled NG provides good electronic conductivity, abundant defects, high surface area, and large mesopore volume. Due to the combination of these merits, Sn@NG exhibits extremely long-term cycling stability, even at high rates, retaining a capacity of 568 mAh g−1 at 1 A g−1 (90% retention) and 535 mAh g−1 at 2 A g−1 (91.6% retention) after 1000 and 900 cycles, respectively. This performance is superior to that of Sn@G (without N-doping) and Sn//NG prepared using a two-step process with large particle sizes (>30 nm) and uneven dispersion of Sn. The findings from this work will shed light on the design of efficient and stable Sn and other metal-based materials for energy storage and conversion.