Photocatalytic hydrogen production is crucial for solar-to-chemical conversion process, wherein high-efficiency photocatalysts lie in the heart of this area. Herein a new photocatalyst of hierarchically mesoporous titanium-phosphonate-based metal-organic frameworks, featuring well-structured spheres, periodic mesostructure and large secondary mesoporosity, are rationally designed with the complex of polyelectrolyte and cathodic surfactant serving as the template. The well-structured hierarchical porosity and homogeneously incorporated phosphonate groups can favor the mass transfer and strong optical absorption during the photocatalytic reactions. Correspondingly, the titanium phosphonates exhibit significantly improved photocatalytic hydrogen evolution rate along with impressive stability. This work can provide more insights into designing advanced photocatalysts for energy conversion and render a tunable platform in photoelectrochemical field.