Based on the unique photoelectrochemical properties of a CoO/Au/g-C3N4 Z-scheme heterojunction, a self-powered photoelectrochemical (PEC) aptasensor was constructed for the detection of microcystin-leucine arginine (MC-LR). Z-scheme heterojunctions can promote the separation of a photo-induced electron-hole pair, and the surface plasmonic resonance (SPR) of Au nanoparticles can significantly enhance the adsorption of visible light. Importantly, MC-LR molecules were captured by aptamers initially immobilized on the modified electrode due to their high affinity, and then oxidized by the photogenerated holes, which caused an amplified photocurrent signal, allowing the quantitative analysis of MC-LR by measuring the photocurrent intensity change. This PEC MC-LR aptasensor showed high sensitivity and selectivity within a wide linear response range from 0.1 pM to 10 nM and a detection limit of 0.01 pM. The application of this sensor in the analysis of lake water samples provided accurate results with a relative standard deviation (RSD) of 2.6%-4.2%.