The invention discloses a sensor system based on a silicon-based mid-infrared sub-wavelength grating waveguide structure, which comprises a laser source, a prism coupling, a gas flow cell, a silicon-based mid-infrared sub-wavelength grating waveguide, a detector, and a computer. The basic principle is that interaction between light generated by the laser source and the gas affects the refractive index distribution of the waveguide mode in the sensor, the variation of a resonance peak in the output spectrum of the sensor is further affected, and based on the variation of the resonance peak, gastype and concentration detection is realized. According to the silicon-based sub-wavelength grating waveguide, top Si of a silicon-on-insulator material is etched to form a sub-wavelength grating (SWG) waveguide, holes are opened at two sides of the waveguide, the insulating layer SiO2 middle part is hollowed out, and a suspension waveguide structure with air as a lower cladding is formed. The gas sensor disclosed in the invention does not require fluorescent labeling, has high sensitivity and can effectively monitor gases such as CO2 and CH4 which have a spectral response in the mid-infraredspectral region.