An improved Savitzky–Golay (S–G) filtering algorithm was developed to denoise the absorption spectroscopy of nitrogen oxide (NO2). A deep learning (DL) network was introduced to the traditional S–G filtering algorithm to adjust the window size and polynomial order in real time. The self-adjusting and follow-up actions of DL network can effectively solve the blindness of selecting the input filter parameters in digital signal processing. The developed adaptive S–G filter algorithm is compared with the multi-signal averaging filtering (MAF) algorithm to demonstrate its performance. The optimized S–G filtering algorithm is used to detect NO2 in a mid-quantum-cascade-laser (QCL) based gas sensor system. A sensitivity enhancement factor of 5 is obtained, indicating that the newly developed algorithm can generate a high-quality gas absorption spectrum for applications such as atmospheric environmental monitoring and exhaled breath detection.