Food safety is the focus and hot topic of the global population. Addressing pesticide residues is of great importance for environmental protection and sustainable development. Surface enhanced Raman spectroscopy (SERS), as a semi-quantitative technique, limits the accuracy of quantitative analysis. Therefore, a single analysis method can’t satisfy the study of complex systems. The main goal of this study was to develop a biochemical sensor, SERS and electrochemical methods were used to prove the specific recognition of chlorpyrifos by an aptamer. The detection mechanism is discussed. The partial least squares (PLS) model is introduced in the spectral data analysis to solve the interference problems, so that the developed aptamer can achieve fully selective quantitative analysis. The developed sensor, combined with the PLS model, has high accuracy and precision in the detection of chlorpyrifos residues in real samples. The application of the PLS model to the spiked standard samples of apple and rice improves the recoveries in the range of 92.69% − 112.55% after the addition of the three interfering pesticides. The overall results show that the aptamer-based SERS combined with electrochemistry and the PLS model can be used to solve the problem of accurate quantification of anti-interference and achieve quality and safety.