Foam has been widely used in petroleum industry. It could enhance oil recovery by the means of improving mobility ratio, selective plugging and lowering the interfacial tension(IFT) of oil and water. The influences of concentration, temperature, gas-liquid ratio, permeability and oil saturation on the plugging property of 3 foaming agents were studied experimentally. The foaming agent concentration and the ratio of steam to nitrogen for thermal foam flooding were optimized. Displacement experiments were performed to investigate the EOR effect of 2# foaming agent. It was shown that the resistance factor increased with the increase of the concentration, gas-liquid ratio and permeability and the increase velocity slowed down in the later period of experiments. The optimal concentration was 0.5wt% and the optimum gas-liquid ratio was 1:1. The resistance factor reduced with increasing oil saturation. The plugging ability lost when the oil saturation was greater than 0.2. The resistance factors of 1# and 2# foaming agents decreased with increasing temperature but 3# increased. The best concentration was 0.6wt% and the ratio of steam to nitrogen was 3:2 for steam and nitrogen foam flooding. In the process of thermal foam flooding, oil recovery increased by 20.82%, and the sweep efficiency and displacement efficiency was 13% and 24.6% , separately.