Abstract Enzymatic biofuel cells (EBFCs) have been widely applied in self‐powered biosensing. However, the relatively low catalytic activity and poor stability of enzymes during immobilization limit their applications. Herein, hollow porous metal‐organic frameworks (MOFs) are synthesized to encapsulate glucose oxidase (GOx), which is applied to modify the bioanode of an EBFC‐based self‐powered biosensor to reduce interfacial interactions and improve the enzyme catalytic activity and stability. Based on aptamer recognition of the target Escherichia coli ( E. coli ), a cascade reaction is triggered on the bioanode, followed by the catalytic hairpin assembly (CHA) on the biocathode for signal amplification. This self‐powered biosensing platform exhibits high sensitivity and selectivity for E. coli detection in the range of 10 to 1.0 × 10 7 CFU mL −1 (S/N = 3) with a detection limit of 3 CFU mL −1 . Moreover, owing to the generation of Ag + during the cascade reaction, the in situ elimination of E. coli is realized. This study provides a new perspective for integrating the detection and in situ elimination of pathogenic environmental bacteria.