This paper describes the development of a reproducible molecularly imprinted piezoelectric sensor for the accurate and sensitive detection of ractopamine (RAC) in swine and feed products. The synthesized molecularly imprinted polymer (MIP) was directly immobilized on the surface of a quartz crystal microbalance (QCM) Au chip as the recognition element. The experimental parameters in the fabrication, measurement and regeneration process were evaluated in detail to produce an MIP-based piezoelectric sensor with high sensing capability. The developed piezoelectric sensor was verified to perform favorably in the RAC analysis of swine and feed products, with acceptable accuracy (recovery: 75.9–93.3%), precision [relative standard deviation (n = 3): 2.3–6.4%], and sensitivity [limit of detection: 0.46 ng g −1 (swine) and 0.38 ng g −1 (feed)]. This portable MIP-based chip for the piezoelectric sensing of RAC could be reused for at least 30 cycles and easily stored for a long time. These results demonstrated that the developed MIP-based piezoelectric sensor presents an accurate, sensitive and cost-effective method for the quantitative detection of RAC in complex samples. This research offers a promising strategy for the development of novel effective devices used for use in food safety analysis.