The integration of sterilization capabilities into sensing platforms is a crucial step in mitigating the significant health risks associated with the persistence of pathogenic bacteria. In this study, we developed a photoelectrochemical (PEC) pathogenic bacteria sensing platform integrated with sterilization function. The platform was based on the g-C3N4 nanosheets decorated with AuNPs and Poly(3-thiophene boronic acid) (PTBA). The incorporation of AuNPs and PTBA proved highly beneficial for enhancing the PEC and photocatalytic performance of bulk g-C3N4. Leveraging the boronic acid group of PTBA, we achieved the selective capture of pathogenic bacteria on the surface of the electrode. The platform showed a high detection sensitivity towards Escherichia coli (E. coli) with a low limit detection (30.5 cfu/mL). Furthermore, the sensing platform demonstrated an exceptional antibacterial rate (99.9 %) resulting from the photoelectrocatalytic effect of PTBA/AuNPs/g-C3N4. This research presents a potential application of the platform as a self-cleaning biosensor for pathogenic diagnosis.