Photoacoustic spectroscopy in a differential Helmholtz resonator has been employed with near-IR and red diode lasers for the detection of CO2, H2S and O2 in 1 bar of air/N2 and natural gas, in static and flow cell measurements. With the red distributed feedback (DFB) diode laser, O2 can be detected at 764.3 nm with a noise equivalent detection limit of 0.60 mbar (600 ppmv) in 1 bar of air (35-mW laser, 1-s integration), corresponding to a normalised absorption coefficient α = 2.2 × 10-8 cm-1 W s1/2. Within the tuning range of the near-IR DFB diode laser (6357-6378 cm-1), CO2 and H2S absorption features can be accessed, with a noise equivalent detection limit of 0.160 mbar (160 ppmv) CO2 in 1 bar N2 (30-mW laser, 1-s integration), corresponding to a normalised absorption coefficient α = 8.3 × 10-9 cm-1 W s1/2. Due to stronger absorptions, the noise equivalent detection limit of H2S in 1 bar N2 is 0.022 mbar (22 ppmv) at 1-s integration time. Similar detection limits apply to trace impurities in 1 bar natural gas. Detection limits scale linearly with laser power and with the square root of integration time. At 16-s total measurement time to obtain a spectrum, a noise equivalent detection limit of 40 ppmv CO2 is obtained after a spectral line fitting procedure, for example. Possible interferences due to weak water and methane absorptions have been discussed and shown to be either negligible or easy to correct. The setup has been used for simultaneous in situ monitoring of O2, CO2 and H2S in the cysteine metabolism of microbes (E. coli), and for the analysis of CO2 and H2S impurities in natural gas. Due to the inherent signal amplification and noise cancellation, photoacoustic spectroscopy in a differential Helmholtz resonator has a great potential for trace gas analysis, with possible applications including safety monitoring of toxic gases and applications in the biosciences and for natural gas analysis in petrochemistry. Graphical abstract.