A novel gelled foam for conformance control was investigated for its ability to enhance oil recovery (EOR) in high temperature and high salinity reservoirs. The formulation optimization, foaming performance, and core flooding performance of the gelled foam were systematically evaluated under harsh reservoir conditions. The gelled foam formulation was optimized with 0.4% polymer (hydrolyzed polyacrylamide; HPAM), 0.06% cross-linker (phenolic) and 0.2% foaming agent (sulphobetaine; SB). The addition of the gel improved the stability of the foam system by 3.8 times that of traditional foam. A stabilization mechanism in the gelled foam was proposed to describe the stabilization process of the foam film. The uniformly distributed three-dimensional network structure of the gel provided a thick protective layer for the foam system that maintained the stability of the foam and improved the strength and thickness of the liquid film. The gelled foam exhibited good formation adaptability, profile control, and EOR performance. The foam flowed into the high permeability layer, plugged the dominant channel, and increased the swept volume. Oil recovery was enhanced by 29.4% under harsh high -temperature and high salinity conditions.