Exploring highly efficient electrocatalyst for H2O2 production based on two-electron oxygen reduction reaction (2e− ORR) is still a challenge. Herein, we design and fabricate a 3D interconnected P-doped nickel/porous carbon material (P-Ni/MC) through a NaCl template-assisted strategy. The interconnected macro/meso/micro-porous structure increases the specific surface area of catalyst with higher mass transfer rate, and the phosphating treatment endows the catalyst with a disordered amorphous state, which induces more active sites on catalyst surface and thus boosting their electrocatalytic performance for 2e− ORR. When tested in 0.1 M KOH, a considerable H2O2 yield of 4.40 mol h−1 gcat.−1 and an outstanding H2O2 selectivity over 98% can be obtained with decent electrochemical durability, which is 3-folds higher than that of Ni/MC without phosphating (1.46 mol h−1 gcat.−1). This strategy opens the eyes for developing highly efficient carbon-based catalyst for 2e− ORR by modulating its crystallinity through phosphating.