Carbon dioxide (CO2) sensing using an optical technique is of great importance in the environment and industrial emission monitoring. However, limited by the poor specific adsorption of gas molecules as well as insufficient coupling efficiency, there is still a long way to go toward realizing a highly sensitive optical CO2 gas sensor. Herein, by combining the advantages of a whispering-gallery-mode microcavity and a metal-organic framework (MOF) film, a porous functional microcavity (PF-MC) was fabricated with the assistance of the atomic layer deposition technique and was applied to CO2 sensing. In this functional composite, the rolled-up microcavity provides the ability to tune the propagation of light waves and the electromagnetic coupling with the surroundings via an evanescent field, while the nanoporous MOF film contributes to the specific adsorption of CO2. The composite demonstrates a high sensitivity of 188 nm RIU-1 (7.4 pm/% with respect to the CO2 concentration) and a low detection limit of ∼5.85 × 10-5 RIU. Furthermore, the PF-MC exhibits great selectivity to CO2 and outstanding reproducibility, which is promising for the next-generation optical gas sensing devices.