The surface microstructure of the electron transport layer (ETL) is crucial for the performance and stability of n–i–p perovskite solar cells (PSCs) as it affects electron transport and perovskite crystallization. However, improving the ETL surface microstructure to simultaneously eliminate interface defects and enhance the perovskite crystalline quality is a key challenge to date. To address this issue, we have developed a 2D metal–organic framework (MOF), Zn-TCPP, using it as a multifunctional template to modulate the ETL/perovskite interface. The Zn-TCPP features a periodic pore structure that promotes the ordered nucleation of perovskite, resulting in an improvement in film crystallinity. Furthermore, its organic linker can interact with Pb2+ and I–, reducing the density of interface defects. Moreover, the perovskite immersed within the pores of Zn-TCPP forms radial junctions, leading to an increased charge extraction efficiency. Consequently, PSCs based on Zn-TCPP nanosheets exhibit an enhanced power conversion efficiency (23.54%) and they demonstrate significantly improved environmental resistance, retaining 88% of their original efficiency after a 550 h period. This study underscores the tremendous potential of low-dimensional MOF materials in optimizing PSC performance.