Chlorpyrifos is an organophosphorus insecticide, which can be used to control a variety of chewing and piercing mouthparts pests in agricultural production. It can destroy the normal nerve impulse conduction by inhibiting the activity of acetylcholinesterase or cholinesterase in the nerves, causing a series of poisoning symptoms. In order to achieve the quantitative analysis of chlorpyrifos residues in agricultural products, an aptamer-controlled signal molecule release method was developed in this study. The signal molecule 4-ATP of surface-enhanced Raman spectroscopy (SERS) was loaded into aminated mesoporous silica nanoparticles (MSNs-NH2) prepared by the one pot method, and then coated with an aptamer of chlorpyrifos through electrostatic interaction. The specific binding of the aptamer and chlorpyrifos led to the release of 4-ATP, and the amount of 4-ATP released was positively correlated with the amount of chlorpyrifos. Finally, the standard curve of chlorpyrifos quantitative detection based on SERS was established. Meanwhile, Ag-carrying mesoporous silica (Ag@MSNs) was prepared as the reinforcement substrate for SERS detection. The results showed that there was a good linear correlation between the Raman intensity and the concentration of chlorpyrifos at 25–250 ng/mL, and the limit of detection (LOD) was 19.87 ng/mL. The recoveries of chlorpyrifos in the apple and tomato samples were 90.08–102.2%, with RSD < 3.32%. This method has high sensitivity, specificity, reproducibility and stability, and can be used for the quantitative detection of chlorpyrifos in the environment and agricultural products.