An ultrasensitive photoelectrochemical (PEC) aptasensor based on Bi4Ti3O12/[email protected]/Ag2S was proposed for the detection of Hg2+. The indium tin oxide (ITO) electrode was first decorated with the nested hollow bismuth titanate (Bi4Ti3O12) that functioned with [email protected] as an electron mediator to accelerate the photocurrent conversion, and then silver sulfide (Ag2S) nanoparticles were grown in-situ to enhance the PEC response. The band gap of Ag2S is so narrow that photogenerated electrons are easily generated under illumination. [email protected] acts as an electron medium to facilitate electron transfer from the conduction band of Ag2S to the valence band of Bi4Ti3O12. The quantitative detection of Hg2+ was achieved based on the thymidine - Hg2+ - thymidine (T- Hg2+-T) specific interaction. The results showed that the PEC aptasensor showed a wide linear range (1 mM-0.1 pM) and a low detection limit (19 fM). In addition, the aptasensor has excellent selectivity, reproducibility and stability, providing a feasible method for the detection of Hg2+.