Gas detection is crucial in a wide range of fields and applications, such as safety and process control in the industry, atmospheric sciences, and breath diagnostics. Optical gas sensing offers some key advantages, compared to other sensing methods such as electrochemical and semiconductor sensing: high specificity, fast response, and minimal drift. Wavelengths between 3 and 10 μm are of particular interest for gas sensing. This spectral range, called the mid-infrared (mid-IR), is also known as the fingerprint region, because several gas species can be identified by their sharp absorption lines in this region. The most relevant mid-IR-active gases are the trace gases carbon dioxide (CO2), methane (CH4), carbon monoxide (CO), ammonia (NH3), and nitrous oxide (N2O). They are greenhouse gases, contributing to global warming. They are waste products of human activities and widely used in agriculture and industry. Therefore, it is crucial to accurately and extensively monitor them. However, traditional optical gas sensors with a free-space optical path configuration, are too bulky, power-hungry, and expensive to be widely adopted. This thesis presents mid-IR integrated photonic devices that enable the on-chip integration of optical gas sensors, with a focus on CO2 sensing. The reported technologies address the fundamental sensor functionalities: light-gas interaction, infrared light generation, and infrared light detection. The thesis introduces a novel mid-IR silicon photonic waveguide that allows a light path as long as tens of centimeters to fit in a volume smaller than a few cubic millimeters. Mid-IR CO2 spectroscopy demonstrates the high sensing performance of the waveguide. The thesis also explores the refractive index sensing of CO2 with a mid-IR silicon photonic micro-ring resonator. Furthermore, the thesis proposes platinum nanowires as low-cost infrared light sources and detectors that can be easily integrated on photonic waveguides. Finally, the thesis presents a large-area infrared emitter fabricated by highs-peed wire bonding and integrated in a non-dispersive infrared sensor for the detection of alcohol in breath. The technologies presented in this thesis are suited for cost-effective mass production and large-scale adoption. Miniaturized integrated optical gas sensors have the potential to become the main choice for an increasingly broad range of existing and new applications, such as portable, distributed, and networked environmental monitoring, and high-volume medical and consumer applications