Sunlight-driven photosynthesis by covalent organic frameworks (COFs) from water and air without using sacrificial reagents is a promising H2O2 fabrication approach, but is still restricted by the insufficient charge separation and sluggish 2e- water oxidation process. Herein, we provide a facile strategy to simultaneously improve charge separation and water oxidation in COFs via confining the charge transfer pathways from two diversion ones to a confluence one through regulating the site of nitrogen in bipyridine. Combining in-situ characterization with computational calculations, we reveal that compared to COF-BD1 containing two diversion charge transfer pathways, the charge transfer pathway in COF-BD2 is confined to a confluence one due to the electron-deficiency effect of nitrogen, which greatly accelerates the intermolecular and out-of-plane charge transfer. Via effectively reducing the energy barrier of rate-determining water oxidation reaction, the subsequent water oxidation process to produce key *OH intermediate in COF-BD2 is also greatly facilitated, boosting the yield of H2O2 (5211 μmol g-1 h-1) from water, oxygen, and light without sacrificial agents or additional energy consumption. We further demonstrate that H2O2 can be efficiently produced by COF-BD2 in broad pH range, in real water, and in enlarged reactor with using natural sunlight for water decontamination.