In this work, a sensitive potentiometric resolved ratiometric photoelectrochemical aptasensor for Escherichia coli (E. coli) detection was successfully fabricated with non-metallic nanomaterials. To avoid the use of precious metals or heavy metals, three-dimensional graphene hydrogel-loaded carbon quantum dots (C-dots/3DGH) and graphene-like carbon nitride (g-C3N4) with excellent PEC activity and matched potential were prepared. These two materials were modified onto two adjacent areas on the ITO electrode. By applying different bias voltage, the cathodic current generated by C-dots/3DGH and the anodic current generated by g-C3N4 can be clearly distinguished and would not interfere with one another. Then E. coli aptamer was modified onto the surface of C-dots/3DGH. In the presence of targets, the binding of E. coli with aptamer lead to the steric hindrance greatly increased and the cathodic current decreased significantly. Meanwhile, the anodic current generated by g-C3N4 was not influenced and it can serve as a stable reference to evaluate the environmental factors. Therefore, the concentration of E. coli can be quantified by the ratio of cathodic current to anodic current, which can effectively eliminate these analyte-independent factors and provide a more precise analysis. In addition, this ratiometric PEC biosensor also showed a good sensitivity and a wide linear range (2.9 cfu/mL to 2.9 × 106 cfu/mL).