The low specific surface area and low charge transfer efficiency of conventional graphite carbon nitride (g-C3N4) are the main obstacles to its application in photocatalytic CO2 reduction. In this paper, graphite carbon nitride was protonated by phosphoric acid (H3PO4), and a new few-layer porous carbon nitride was prepared by intercalation polymerization with doping bimetal in the cavity of g-C3N4. Under visible light irradiation, the CO formation rate of Co/Ni co-doped g-C3N4 can reach 13.55 μmol g-1 h-1, which was 3.9 times higher than that of g-C3N4 (3.49 μmol g-1 h-1). The density functional theory (DFT) calculations showed that the addition of Co and Ni in the cavity of g-C3N4 can induce bimetallic synergistic regulation of the electronic structure, thus improving the separation efficiency of charges and visible light capture ability of g-C3N4. Our work has great reference value for designing and synthesizing novel bimetallic co-doped g-C3N4 photocatalytic materials.