Rational construction of Z-scheme heterojunction photocatalysts have been regarded as a promising approach for enhanced hydrogen generation performance from splitting water. Herein, a Z-scheme heterojunction CoS@NC/CdS using N doped carbon (NC) as an electron mediator bridge was fabricated by coupling CdS with CoS@NC prepared via solid-state self-sulfuring a novel cationic cobalt (Co) based metal–organic framework (namely PZH-42) under argon atmosphere. Notably, the H2 production activity could be optimized by regulating the sulfurization temperature and the content of CoS@NC. The 20-CoS@NC−700/CdS with sulfurization temperature of 700 ℃ and the content for CoS@NC−700 of approximately 20 wt% exhibited the highest H2 generation activity of 20.56 mmol h−1 g−1 with an apparent quantum efficiency (AQE) of 23.98 %, which was 70 and 10-folds as high as that of CdS and CdS/CoS. Such improvement might be attributed to the four synergisms of rapidly separating the electrons and holes by the NC electron mediator bridge in Z-scheme system, retaining electrons at the higher position conduction band (CB) of Z-scheme heterojunction more than that of the type-II heterojunction, increasing the specific surface area and enhancing light absorption range and intensity. More significantly, this rare idea can not only provide a promising strategy for designing highly efficient Z-scheme heterojunction photocatalysts, but also expand the photocatalytic H2 production applications of Co-based metal–organic framework.