Gas sensors are important in many fields such as environmental monitoring, agricultural production, public safety, and medical diagnostics. Herein, tamm plasmon resonance in a photonic bandgap is used to develop an optical gas sensor with high performance. the structure of the proposed sensor comprises a gas cavity sandwiched between a one-dimensional porous silicon photonic crystal and an Ag layer deposited on a prism. the optimised structure of the proposed sensor achieves ultra-high sensitivity (S = 1.9×10 5 nm/RiU) and a low detection limit (DL = 1.4×10 −7 RiU) compared to the existing gas sensor. the brilliant sensing performance and simple design of the proposed structure make our device highly suitable for use as a sensor in a variety of biomedical and industrial applications. Gas sensing has different applications in many fields such as the food industry, medicine, safety, environment, agriculture, and cosmetic 1,2. For example, the detection of volatile organic compounds such as acetone and toluene in exhaled breath is used as a biomarker for many diseases 3,4. In addition, the determination of the concentration of harmful gases such as CO 2 and N 2 O can be applied as an environmental pollution monitor 5. Currently, optical gas sensors are of great interest to researchers because they do not require complicated radioactive/fluorescent labels 6,7. Surface plasmon resonance, Tamm plasmon (TP) resonance, waveguide, and photonic crystal are all examples of platforms for optical sensing 8-12. Photonic crystals (PCs) are useful for a wide range of biomedical and environmental sensing applications. This is due to an impressive set of relevant properties, such as ultrahigh sensitivity, low detection limit, and fast response time 13,14. PC refers to a range of materials characterised by a periodic refractive index along one, two, or three dimensions (1DPC, 2DPC, or 3DPC, respectively). The propagation of electromagnetic waves in PCs can be controlled because of the photonic bandgap (PBG) 15-17. 1DPCs are more appropriate for most applications, given their low cost and ease of fabrication compared to 2DPCs and 3DPCs 18. Recently, PCs have been widely used in various sensor systems. A high-precision gas index sensor, which was proposed by Jágerská et al., reached a sensitivity of 510 nm/RIU based on a PC air-slot cavity 19. Hua-Jun studied a surface plasmon resonance nanocavity antenna array for use as a gas sensor with a high sensitivity of 3200 nm/RIU 20. Wang et al. suggested a guided-mode resonance gas sensor with a sensitivity as high as 748 nm/ RIU 21. Pevec and Donlagic designed a fiber-optic Fabry-Perot gas sensor with a sensitivity of 1550 nm/RIU 22. García-Rupérez et al. presented a highly sensitive device for antibody detection using the slow light regime of a PC waveguide 23. Chen et al. designed a PC/Ag/graphene structure to function as a refractive index sensor based on the Tamm state, with a numerical sensitivity of 1178.6 nm/RIU 24. Auguié et al. studied TP resonance at the interface between a meta...