Covalent organic frameworks (COFs), known for the precise tunability of molecular structures, hold significant promise for photocatalytic hydrogen peroxide (H2O2) production. Herein, by systematically altering the quinoline (QN) linkages in triazine (TA)-based COFs via the multi-component reactions, six R-QN-TA-COFs are synthesized with identical skeletons but different substituents. The fine-tuning of the optoelectronic properties and local microenvironment of COFs is allowed, thereby optimizing charge separation and improving interactions with dissolved oxygen. Consequently, MeO-QN-TA-COF is customized to achieve an impressive rate of H2O2 production up to 7384 mu mol g(-)1 h(-)1 under an air atmosphere in water without any sacrificial agents, surpassing most of the reported COF photocatalysts. Its high stability is demonstrated through five consecutive recycling experiments and the characterization of the recovered COF. The reaction mechanism for the H2O2 production is further investigated using a suite of quenching experiments, in situ spectroscopic analysis, and theoretical calculations. The enhanced photocatalytic H2O2 production over MeO-QN-TA-COF is through 2e(-) oxygen reduction reaction and water oxidation reaction pathways. Overall, the crucial role of linkage microenvironment modulation in the design of COFs for solar-driven effective photocatalytic H2O2 production.