The storage atmosphere of low O2 and high CO2 concentration can regulate plant cell respiration and microbial growth, which plays a crucial role in food preservation. However, traditional modified atmosphere packaging (MAP) cannot accurately control gas penetration. In this study, a novel strategy for accurately controlling the selective CO2/O2 permeation is developed by using nanoMOFs with different pore structures as gas “switches”. Combined with experimental data and molecular simulation results show that the selective CO2/O2 permeations of nanoMOFs/carboxymethylcellulose(CMC)/Zein are successfully controlled from 2.87 ± 0.12 to 8.65 ± 1.63 owing to the synergistic effect of nanoMOFs with different pore structures and the different affinity between nanoMOFs and molecules of CO2 and O2. In which, 1.6 % HKUST-1/CMC/Zein has the best CO2/O2 selectivity of 8.65 ± 1.63. Furthermore, the 1.6 % HKUST-1/CMC/Zein with excellent antibacterial activity and selective CO2/O2 permeation can maintain the appearance and freshness of mango for at least 7 days compared with other packaging films. Therefore, we have developed a new type of gas “switches” for MAP to accurately control the selective permeation of gases at the molecular level, which will expand the application of MAP in food preservation field.