Recent advances in perovskite solar cells (PSCs) have been significantly propelled by innovations in surface defect passivation. In this study, we introduce a novel method termed thermal imprinting-assisted ion exchange passivation (TIAIEP), which offers an alternative to traditional solution processing. TIAIEP specifically targets surface defects within solid-state films by employing a passivator, effectively enabling ion exchange directly at the defect sites of the perovskite film. By optimizing both the temperature and the duration of the TIAIEP process, we significantly enhance the formation of a gradient composition within the films. This adjustment markedly reduces the cooling rate of hot carriers, thereby decreasing charge recombination and enhancing device performance. As a result, devices treated with TIAIEP exhibit a marked increase in power conversion efficiency from 21.05% to 22.29%. Furthermore, unencapsulated PSCs based on TIAIEP retained 98% of their initial efficiency after 2300 hours of nitrogen storage and 92% after 800 hours of continuous light exposure. Our findings demonstrate that TIAIEP is not only effective in reducing surface defects but also enhances both the photoelectric performance and stability of PSCs, showing great promise for the passivation of large-scale perovskite films and advancing the commercialization of this technology.