Utilizing artificial photosynthesis for the conversion of CO2 into value-added fuels has been recognized as a promising strategy for the ever-increasing energy crisis and the greenhouse effect. Herein, the element doping engineering of red spherical g-C3N4 having oxygen bonded with compositional carbon (C-O-C) for CO2 photoreduction has been explored to address this challenge. The C-O bond was formed by hydrothermal treatment with dicyandiamide and 1,3,5-trichlorotriazine. The experimental and DFT results displayed the optimum oxygen substitution sites and demonstrated that the oxygen doping greatly improved the light utilization efficiency, CO2 affinity, and charge carrier transfer, which enhanced photoreduction efficiency of CO2. The evolution rates of CO (47.2 μmol g-1) and CH4 (9.1 μmol g-1) using O-CN were much higher than that of bulk-CN without a cocatalyst. The main reason was the contribution of the O 2p orbital to the conduction band (CB) and valence band of O-CN, which effectively reduced the electron mass, facilitating electron/hole separation and enhancing its fluidity. Furthermore, the Fermi level also shifted to the bottom of the CB, leading to higher electron density, which further improved the CO2 reduction ability. Our study marks an important step for developing high-performance photocatalysts for reduction of CO2.