Electroanalytical technologies as a beneficial subject of modern analytical chemistry can play an important role for abused drug analysis which is crucial for both legal and social respects. This article reports a novel aptamer-based biosensing procedure for cocaine analysis by combining the advantages of aptamers as selective recognition elements with the well-known advantages of biosensor systems such as the possibility of miniaturization and automation, easy fabrication and modification, low cost, and sensitivity. In order to construct the aptasensor platform, first, polythiophene bearing polyalanine homopeptide side chains (PT-Pala) was electrochemically coated, onto the surface of an electrode and then cocaine aptamer was attached to the polymer via covalent conjugation chemistry. The stepwise modification of the surface was confirmed by electrochemical characterization. The designed biosensing system was applied for the detection of cocaine and its metabolite, benzoylecgonine (BE), which exhibited a linear correlation in the range from 2.5 up to 10 nM and 0.5 up to 50 mu M for cocaine and BE, respectively. In,order to expand its practical application, the proposed method was successfully tested for the analysis of synthetic biological fluids.