Liquid-state 4-tert-butylpyridine is essential for achieving high performance in n-i-p perovskite solar cells. 4-tert- Butylpyridine effectively dissolves the lithium bis(trifluoromethanesulfonyl)imide dopant and stabilizes lithium ions. However, its high volatility and corrosive nature can degrade the perovskite layer and promote the formation of byproducts and pinholes in the hole transport layer under thermal stress, ultimately compromising device stability. Here we introduce a non-volatile, solid-state alternative-4-(N-carbazolyl)pyridine (4CP)-which stabilizes lithium ions and facilitates the formation of lithium bis(trifluoromethanesulfonyl)imide complexes. Perovskite solar cells incorporating 4CP achieve a power conversion efficiency of 26.2% (25.8% certified) and maintain 80% of their initial performance for over 3,000 h at maximum power point tracking. The unencapsulated devices retain 90% of their initial efficiency after 200 thermal shock cycles between -80 degrees C and 80 degrees C, and under continuous exposure to 65 degrees C and 85 degrees C. The adoption of 4CP could help improve the stability of n-i-p perovskite solar cells.