Layered materials are particularly striking at photochemical conversion, but the weakness of electron transfer and the lack of active surfaces severely limit their potential. Herein, a carbon nitride with enhanced electron transfer and abundant active surfaces (CNS) was prepared through suitable basicity assisted thermal polymerization of urea. The CNS exhibited a rate as high as 208 μM mg−1 h−1 for an easy-to-operable quasi-homogeneous photochemical synthesis of hydrogen peroxide (H2O2), and its internal quantum efficiency at multiple wavelengths is at least an order of magnitude higher than that of other prepared carbon nitride. Characterization and theoretical calculation confirmed that the quantum efficiency of electron transfer from in-plane to oxygen is superior to interplane. Moreover, the hydroxyl and cyanide groups of CNS greatly facilitates the proton-coupled electron transfer process for converting oxygen into H2O2. Our finding paves the way for applications of carbon nitride in mandatory water treatment and offers meaningful insights into modifying layered photocatalysts.