Despite the fact that the exploration of novel materials with excellent photoelectrochemical (PEC) performance is the sought-after objective for its detection of low abundance targets, the introduction of electron donors in a rational and efficient manner to further boost the PEC signals is still desirable. In this work, highly efficient PEC materials Bi2S3/ZnIn2S4 (BZ) heterojunctions were synthesized, and a strategy of aptamer-induced spatially confined electron donors (ASED) was, for the first time, proposed for highly enhanced and stable photocurrent generation. With dopamine (DA) or ascorbic acid (AA) as the electron donor model, ∼ 22-fold PEC signal enhancement could be obtained in the system using the ASED strategy. Furthermore, we established a newly updated PEC biosensor for antibiotic resistance genes based on the BZ materials and ASED strategy by ingeniously incorporating catalytic hairpin assembly (CHA) and DNAzyme cleavage reaction. It was demonstrated that our proposed biosensor exhibited an outstanding linear response to concentration variations from 0.1 fM to 1.0 nM and achieved a detection limit as low as 3.24 aM, without the need for additional electron donors. This strategy significantly enhances the analytical performance by in situ aptamer-promoted spatially confined electron donors toward simple, efficient, and enhanced PEC biosensors, which may shed light on biorecognition of electron donors based smart biosensing with broad applications.