Cocaine (Coc) is one of the illegal drugs and is harmful to digestive, immune, cardiovascular and urogenital systems. To achieve drug abuse control and legal action, it is essential to develop an effective method for cocaine analysis. In this work, an aptasensor has been developed using atom transfer radical polymerization (ATRP) based on host−guest chemistry for electrochemical analysis of cocaine. The NH2−DNA (Apt1) was immobilized on the indium tin oxide (ITO) electrode via addition reaction, and Fc−DNA (Apt2) was introduced to ITO relying on the specific recognition of cocaine. The Apt2 can initiate host−guest chemistry between Apt2 and ATRP initiators (β−CD−Br15), then the β−CD−Br15 further triggers ATRP. Moreover, ATRP avoids the sluggish kinetics and poor coupling capability sustained. The result shows a sensitive and selective analysis of cocaine within a linear range from 0.1 ng/mL to 10 μg/mL (R2 = 0.9985), with the detection limit down to 0.0335 ng/mL. Thus, this strategy provides a universal method for the analysis of illegal drugs.