Hierarchically nanostructured CdS composed of 4.7 nm-thick self-assembled ultrathin nanosheets was synthesised through a microwave-assisted solvothermal method. Ag2S nanoparticles (NPs) were deposited at the edge of the CdS nanosheets by an in situ ion exchange strategy. The hierarchically CdS–Ag2S nanocomposites exhibited a high visible light photocatalytic H2 evolution rate of 375.6 μmol h−1 g−1, which was 11.5 times higher than that of pure CdS. Given the difference in work functions between CdS and Ag2S, electrons diffused from the CdS side to the Ag2S side until the Fermi levels align after their contact. When the CdS–Ag2S was illuminated, the photogenerated electrons on the conduction band of the CdS further migrated to Ag2S. Considering the lower overpotential of Ag2S, the electrons more easily participated in the reduction of protons. Meanwhile, the holes on the valence band of CdS reacted with the hole sacrificial agent (triethanolamine). In this process, the photogenerated electron–hole pairs realised effective separation. The introduction of Ag2S also enhanced the utilisation of infrared light and increased the temperature of CdS surface.