It is of great significance to study the stability of foams in the petroleum industry. Therefore, the stability mechanism of Span 20, the fluorinated surfactant FCO‐80 and their mixture FS in a CO2 oil‐based foam system were studied by molecular simulation. The sandwich model of CO2 oil‐based foam was constructed to reveal the stability of the foam system from the microscopic perspective. The result shows that under the synergistic effect of Span 20 and FCO‐80, the oil–CO2 distance of the FS foam system and the coordination number of oil molecules are larger than those of Span 20 and FCO‐80 foam system. In FS foam system, the diffusion coefficients of CO2 molecules are small, and the surface tension is reduced, which can improve the stability of foam. The results can supplement previous experimental results on the stability of oil‐based foam.