This study examines the impact of CO2 concentration on the stability and plugging performance of polymer-enhanced foam (PEF) under high-temperature and high-pressure conditions representative of the steam front in heavy oil reservoirs. Bulk foam experiments were conducted to analyze the foam performance, interfacial properties, and rheological behavior of CHSB surfactant and Z364 polymer in different CO2 and N2 gas environments. Additionally, core flooding experiments were performed to investigate the plugging performance of PEF in porous media and the factors influencing it. The results indicate that a reduction in CO2 concentration in the foam, due to the lower solubility of N2 in water and the reduced permeability of the liquid film, enhances foam stability and flow resistance in porous media. The addition of polymers was found to significantly improve the stability of the liquid film and the flow viscosity of the foam, particularly under high-temperature conditions, effectively mitigating the foam strength degradation caused by CO2 dissolution. However, at 200 °C, a notable decrease in foam stability and a sharp reduction in the resistance factor were observed. Overall, the study elucidates the effects of gas type, temperature, and polymer concentration on the flow and plugging performance of PEF in porous media, providing reference for fluid mobility control at the steam front in heavy oil recovery.