Developing high-performance sensors for detecting mycotoxin is of great significance for food safety. Herein, a novel electrochemical aptasensor for the detection of aflatoxin B1 (AFB1) was fabricated via layer-by-layer self-assembly technology. Positively charged poly (diallyl dimethylammonium chloride) modified graphene nanosheets and negatively charged carboxylated polystyrene nanospheres were alternately deposited on the electrode. The resulting multi-layered sandwich structured electrode afforded abundant electrochemical active sites and excellent conductivity. The aptamer of AFB1 was immobilized to the surface of the carboxyl-functionalized polystyrene nanospheres via an amide bond. The electrode was treated by solutions of ethanolamine and bovine serum albumin to improve the specific selectivity. The charge transfer resistance of the electrodes as determined from the Nyquist plots was well correlated with the concentration of AFB1 in the samples. The optimized electrochemical aptasensor exhibited a limit of detection of 0.002 ng mL−1 and outstanding stability after 30 days, rendering it to be one of the best aptasensors for the detection of mycotoxin reported in the literature. The electrochemical aptasensor was practically employed for the detection of AFB1 in oil and soy sauce, yielding recovery values in the range of 94.5 and 103.3%.