Three-dimensional (3D) porous carbon materials have received substantial attention owing to their unique structural features. However, the synthesis of 3D porous carbon, especially 3D porous carbon with hollow spheres structures at the connection points, still pose challenges. Herein, we first develop a metal-organic complexes@melamine foam (MOC@MF) template strategy, by using hot-pressing and carbonization method to synthesize 3D porous carbon with hollow spheres structures (denoted as NOPCs). The formation mechanism of NOPCs can be attributed to the difference in Laplace pressure and surface energy gradient between the carbonized MOC and carbonized MF. These rare 3D porous carbons exhibit high BET surface area (2453.8 m2 g-1), N contents (10.5%), and O contents (16.3%). Moreover, NOPCs show significant amounts of toluene and methanol at room temperature, reaching as high as 1360 and 1140 mg g-1. The adsorption amounts of SO2 and CO2 for NOPCs are up to 93.1 and 445 mg g-1. Theoretical calculation indicates surfaces of porous carbon with N and O coexistence could strongly enhance adsorption with high adsorption energy of -65.83 kJ mol g-1.