Hydrogen peroxide (H2O2) has been widely used as eco-friendly oxidant in many chemical industries and environmental areas. Photocatalytic H2O2 production based on polymeric carbon nitride (g-C3N4) materials is a burgeoning research direction. The primary and secondary amine groups in g-C3N4 framework are considered to be the adverse reaction active sites during photocatalytic H2O2 generation process. Besides, these amine groups can easily form hydrogen bonds with each other which will weaken the separation and transfer of photogenerated carriers in the basal plane of g-C3N4, thus greatly restricts the H2O2 production efficiency. Here, three organic molecules (acetyl chloride, oxalyl chloride and trimesoyl chloride) were successfully covalently introduced into the g-C3N4 through an amide bond synthesis method between amine group and acyl chloride group (ac-g-C3N4-n, oc-g-C3N4-n and tc-g-C3N4-n). All three composites show an enhanced performance toward photocatalytic hydrogen peroxide production compared with pristine g-C3N4. The highest reaction activity reaches 3.2 mmol L−1 in 6 h, which is 3-fold than that of the pristine g-C3N4. This study provides a novelty approach to modify g-C3N4 that focuses on the properties of the semiconductor itself and in-depth insight into the modulation of in-plane electrical conductivity at molecular scale.