The high temperature and high pressure (HTHP) cementing environment results in strength retrogression and structure degradation of oil well cement sheath. Silica flour is commonly incorporated in cement paste as a high-temperature stabilizer to enhance the thermal stability. This work investigated the long-term thermal stability of cement pastes modified by silica flour with different particle sizes. The compressive strengths of cement pastes cured at 80 ℃ × 0.1 MPa and 260 ℃ × 21 MPa for 1, 7, 28, 90, 300 and 400 d were tested. The phase evolution and microstructure development of cement pastes were characterized by XRD, TGA, MIP and SEM. The results showed that the oil well cement pastes incorporated with 200-mesh silica flour had the highest compressive strengths after HTHP curing. The pastes with 1000-mesh silica flour exhibited lower thermal stability, because more calcium-rich hydration products were formed in the matrix after the thermal exposure. The dissolution of silica flour under HTHP conditions was not the main factor controlling the hydration of cement pastes. The 1000-mesh silica flour released more Si4+ than the 200-mesh one. This reduced the diffusion rate of Ca2+, resulting in a decrease in the rate of hydration. This affected the compressive strengths of cement pastes modified by silica flour in HTHP environment.