Summary This research fills the gap in understanding the impact of corrosion inhibitors (CIs) and a chelating agent on the rheology and stability of foam under harsh conditions. In this regard, a modified high-pressure, high-temperature (HPHT) foam rheometer and HPHT foam analyzer were used to investigate foam rheology and stability at 1,000 psi and 120 to 150°C with carbon dioxide (CO2) in the gas phase. Surfactant screening showed that Duomeen TTM and Armovis are thermally stable at high temperature and high water salinity and thus were used in this study. The liquid phase generally contained produced water (PW) (total dissolved solids ~ 24,611 ppm), 15 wt% chelating agent [L-glutamic acid-N, N-diacetic acid (GLDA)], and 1 wt% surfactant with and without a CI. First, we screened the viscosity and stability of Duomeen TTM and Armovis; the results showed that Duomeen TTM has a higher viscosity (at least by 82%) at a low shear rate, but both have similar viscosity at a higher shear rate. However, Armovis produced more stable foam. Once the GLDA was added to the Duomeen TTM solution, the viscosity increased significantly by 135% at a high shear rate (1,000–1,500). For the Armovis system, the viscosity improved by 77% and 68% at the low and high shear rates by adding GLDA. Additionally, foam stability was improved remarkably in both systems; half-life time almost doubled. Finally, we reported the effect of CI on the fluid systems, showing it considerably reduced the foam viscosity and stability. It reduced the half-life of the Armovis system by 79.4% and hindered the generation of foam for the Duomeen TTM system. A detailed discussion of foam properties, such as foamability, bubble count, and bubble radius, is provided. This study provides a wide-ranging understanding of additives’ impact on stimulating foam stability at HPHT.