The redox reaction centers in natural organisms conducting oxygenic photosynthesis are well arranged in a physically separated manner to convert sunlight into chemical energy efficiently. Mimicking natural photosynthesis via precisely constructing oxidative and reductive reaction centers within photocatalysts is ideal for enhancing catalytic performances in artificial photosynthesis. In this study, new covalent heptazine frameworks (CHFs) with spatially separated redox centers are rationally designed for photocatalytic production of H2 O2 from water and oxygen without using any sacrificial agents. Both experimental and computational investigations indicate that the two-electron oxygen reduction reaction occurs on the heptazine moiety, whereas the two-electron water oxidation reaction occurs on the acetylene or diacetylene bond in the CHFs. This unique spatial separation feature is critical for enhancing charge separation and achieving efficient H2 O2 production. Meanwhile, the measured exciton binding energy of the diacetylene-containing polymer is merely 24 meV. Under simulated solar irradiation, the rationally designed CHFs can achieve a solar-to-chemical conversion efficiency of 0.78%, surpassing previously reported photocatalytic materials. This study establishes a molecular engineering approach to construct periodically arranged and spatially separated redox centers in single-component polymer photocatalysts, representing a hallmark to create more exciting polymer structures for photocatalysis moving forward.