Two-dimensional covalent organic frameworks (2D COFs) are promising materials for photocatalytic hydrogen evolution. However, their layer-by-layer assembly is unstable during photocatalysis, leading to disordered stacking and reduced activity. This study introduces a strategy to stabilize the ordered layered structure of 2D COFs using polyethylene glycol (PEG) filling in the mesopore channels. This enhances charge transport and remarkably promotes hydrogen evolution under visible irradiation.