We propose an adaptive algorithm that is a Variational Mode Decomposition (VMD) optimized by the particle swarm optimization (PSO) algorithm, named PSO-VMD. The method selects the envelope entropy of the last intrinsic mode function (IMF) in the VMD as the fitness function of the PSO and 1/10 of the maximum value of the correlation coefficient between the IMFs and the standard signal as the threshold of the correlation coefficient. In the processing of simulated and experimental second harmonic signals, a series of standards, including the same correlation coefficient threshold and standard signal, are used to adaptively achieve noise reduction processing. After processing a simulated signal using PSO-VMD, the signal-to-noise ratio (SNR) was improved by 4.03877 dB and the correlation coefficient (R2) between the gas concentration and the second harmonic maximum was improved from 0.97743 to 0.99782. In the processing of an experimental signal, the correlation coefficient (R2) was 0.99733. The mean value and standard deviation of the second harmonic signal of multiple cycles processed by PSO-VMD were improved compared to the unprocessed experimental signal. This demonstrated that the method has the advantage of being reliable and stable.