Herein, we prepare a type of organic/inorganic hybrid photocatalyst by in situ polymerization of cobalt phthalocyanine on mesoporous g-C3N4 (mpg-C3N4) for photocatalytic CO2 reduction. Photocatalytic results indicate that this photocatalyst can effectively reduce CO2 to CO with high activity and remarkable long-term stability in organic solvents under visible-light irradiation. Our work provides a versatile strategy to synthesize a highly active organic/inorganic composite for photocatalysis.