In this study, we propose a novel surface-enhanced Raman scattering (SERS) method for quantifying aflatoxin B1 (AFB1). This method relies on the target-triggered release of a SERS reporter from aptamer-sealed aminated mesoporous silica nanoparticles (MSNs). These MSNs were synthesized to accommodate 4-mercaptophenylboronic acid (4-MPBA) within their well-defined micropores, which were subsequently sealed with AFB1 aptamers. Upon specific binding of AFB1 to its aptamer, the conformational change in the aptamer is regulated by the presence of the target. Consequently, a positive linear relationship between the AFB1 concentration and the 4-MPBA SERS signal was observed. Under optimal conditions, the method exhibited a good linear relationship over the range of 0.1 to 5 ng/mL AFB1, with a limit of detection (LOD) of 0.03 ng/mL. This strategy was validated using wheat samples, yielding results comparable to high performance liquid chromatography-fluorescence detector (P > 0.05), confirming its reliability for detecting AFB1 in complex food matrices.