Hydrogen evolution by photocatalysis is an ideal method to relieve the energy crisis. In this work, an all-solid-state Z-scheme photocatalytic system is developed via a simple hydrothermal strategy to anchor CdS–MoS2 hybrid nanoparticles onto oxygen-doped g-C3N4 nanosheets (OCN). The presence of MoS2 nanosheets serves as both an intermediary for electron transfer to enhance charge separation and enhance the durability of the CdS. Compared to the unmodified CdS, the H2 generation efficiency of the CdS–MoS2/OCN Z-scheme heterojunctions is significantly enhanced. Additionally, the optimized photocatalyst exhibits a remarkable 20.7-fold increase in H2 production rate compared to the pristine CdS. Based on the systematical characterization, the enhanced photocatalytic hydrogen evolution performance arises from the enhanced light absorption, the enlarged specific surface areas, as well as the improved charge separation. The systematic characterizations provided evidence for the demonstration of the Z-scheme photocatalytic mechanism. This work presents a novel perspective on the design of photocatalytic systems with an all-solid-state Z-scheme configuration.