To investigate the mechanisms of enhancing oil recovery and the flow behaviors of foamed gel in porous media, foamed gels with characteristics of excellent strength and viscosity were prepared with polymer, crosslinking agent, foam agent, and formation water. The breakthrough-vacuum method and a rotary viscometer were used to evaluate the strength and viscosity of foamed gel. Coreflooding and pore-level visualization experiments were performed in heterogeneous reservoir models. Laboratory results illustrate that high strength and viscosity of foamed gel can be prepared by 0.15% NJ-8, 0.2% polyacrylamide solution, and 1.5% foaming agent. The strength and viscosity of the foamed gel reached 0.06MPa and 10,000MPas, respectively. The results of coreflooding experiments in heterogeneous cores show that oil recovery can be improved by approximately 36.9% after injecting 0.3 pore volume of the foamed gel, and enhanced oil recovery is mainly attributed to the improving sweep efficiency of mid- to low-permeability layers. Images of visualization flooding demonstrate that foamed gel exhibits good oil resistance and elasticity when used with crude oil. Furthermore, the new amoeba effect, Jamin effect, fluid-diverting effect, and extruding effect between foamed gel and oil in porous media can enhance oil recovery by improving sweep efficiency.