In this paper a perfect absorber with a photonic crystal cavity (PhC-cavity) is numerically investigated for carbon dioxide (CO2) gas sensing application. Metallic structures in the form of silver are introduced for harnessing plasmonic effects to achieve perfect absorption. The sensor comprises a PhC-cavity, silver (Ag) stripes, and a host functional material—Polyhexamethylene biguanide polymer—deposited on the surface of the sensor. The PhC-cavity is implemented within the middle of the cell, helping to penetrate the EM waves into the sublayers of the structure. Therefore, corresponding to the concentration of the CO2 gas, as it increases, the refractive index of the host material decreases, causing a blue shift in the resonant wavelength and vice versa of the device. The sensor is used for the detection of 0–524 parts per million (ppm) concentration of the CO2 gas, with a maximum sensitivity of 17.32 pm (pico meter)/ppm achieved for a concentration of 366 ppm with a figure of merit (FOM) of 2.9 RIU−1. The four-layer device presents a straightforward and compact design that can be adopted in various sensing applications by using suitable host functional materials.