Carbon nitrides have attracted broad attention in the field of photocatalytic H2 evolution. However, the design and preparation of carbon nitrides with highly efficient charge separation and transfer are still challenging. Here, we synthesized a novel heptazine derivative-based photocatalyst, named as M+U-x to overcome the inherent limitations of carbon nitrides (C3N4 and C3N5). Experimental and theoretical calculation results reveal that the resultant M+U-x is composed by electron-withdrawing C3N4 and electron-donating C3N5 moieties, which are integrated into the conjugated framework via N-atoms and azo bridging units to form molecular heterojunctions. Among these, M+U-3 can dramatically facilitate the spatial separation of photoinduced charge carriers, delivering significantly high visible-light-responsive H2 evolution activity of 372 μmol h−1 with an AQY of 21.6% at 400 nm. This work provides a novel strategy for rationally modulating the bridging units of carbon nitrides to acquire enhanced charge-carrier mobility and efficient photocatalytic H2 evolution from the molecular level.