Constructing effective active sites on photocatalysts is key to promoting H2 evolution activity. Although nickel sulfides are found to be non-noble cocatalysts with high cocatalytic performance, the effect of the S element on H2 evolution still needs to be clarified. Herein, NiSx (x = 0, 1 and 2) cocatalysts are successfully anchored respectively on the surface of porous g-C3N4via the same solid-state method. The combined experimental and theoretical calculations reveal that an intimate Schottky junction constructed between metallic NiSx and PCN impels the rapid transfer of electrons from PCN to NiSx., which promotes a charge separation efficiency and enhances photocatalytic activity. Furthermore, the introduction of the S in the NiSx lattice regulates the adsorption and desorption energies of reactant (H+) and product (H2), determining the H2-evolving performance. Among the Ni, NiS and NiS2 cocatalysts, the S element in the NiS adjusts the equilibrium of adsorption and desorption for H+/H2, resulting in the most favorable thermodynamics of H2 evolution. The maximum H2-rate of NiS/PCN reaches 142.9 μmol h−1, which is 4.3 and 1.6 times of Ni/PCN and NiS2/PCN. Our results gain a deeper understanding of the mechanism that transition metal dichalcogenide based cocatalysts promote photocatalytic activity.