A wavelength scanning scheme enabled by phase-shifted fiber Bragg grating (PS-FBG) is proposed for gas absorption spectroscopy based on optical frequency comb (OFC). The PS-FBG works as an ultra-narrow bandpass optical filter to generate the gas sensing laser probe. To obtain the gas absorption signal, the electronical frequency beating and lock-in amplification are successively performed with the continuous tuning of the PS-FBG by using a piezo transducer (PZT). The intermediate beat note is monitored in real time for lock-in frequency compensation against the repetition frequency drift of the OFC. A carbon monoxide (CO) sensing system in direct absorption spectroscopy (DAS) configuration is developed based on a free-running fiber laser frequency comb. A triangular-wave PZT driving signal of 5 Hz is used for periodical spectrum scanning. At an intermediate beat note of ~ 50 kHz, the DAS signal is obtained with a lock-in constant of 200 μs. The CO detection limit of 0.356% for an integration time of 0.4 s and the minimum detectable absorbance of ~ 0.0021 are achieved, which indicate a better sensitivity performance.