Transition-metal phosphides and sulfides are considered as promising cocatalysts for the photocatalytic hydrogen evolution reaction (HER), and the cocatalytic effect can be improved by directed heterostructure engineering. In this study, a novel lattice-matched CoP/CoS 2 heterostructure having a nanosheet morphology was developed as an HER cocatalyst and integrated in situ onto graphitic carbon nitride (g-C 3 N 4 ) nanosheets via a successive phosphorization and vulcanization route. First-principles density functional theory calculations evidenced that the construction of the lattice-matched CoP/CoS 2 heterostructure resulted in the redistribution of interface electrons, enhanced metallic characteristics, and improved H* adsorption. As a result of these effects, the CoP/CoS 2 heterostructure cocatalyst formed a 2D/2D Schottky junction with the g-C 3 N 4 nanosheets, thus promoting photoelectron transfer to CoP/CoS 2 and realizing fast charge-carrier separation and good HER activity. As expected, the CoP/CoS 2 heterostructure exhibited excellent cocatalytic activity, and the optimal loading of the cocatalyst on g-C 3 N 4 enhanced its HER activity to 3.78 mmol g −1 h −1 . This work furnishes a new perspective for the development of highly active noble-metal-free cocatalysts via heterostructure engineering for water splitting applications.