Herein, we synthesized a novel porphyrinic covalent organic polymer (TPAPP-PTCA PCOP) for constructing a polarityswitchable dual-wavelength photoelectrochemical (PEC) biosensor with ferrocene (Fc) and hydrogen peroxide (H 2 O 2 ) as regulator and amplifier simultaneously. Interestingly, this new PCOP possessed both n-type and p-type semiconductor characteristics, which thus enabled the appearance of a dual-polarity photocurrent at two different excitation wavelengths. Furthermore, Fc and H 2 O 2 could readily switch the photocurrent of PCOP to the cathode and anode stemming from its efficient electron collection and donation function, respectively. Based on these, a PCOPbased PEC biosensor skillfully integrating dual wavelengths with reliable accuracy and polarity switch with high sensitivity was instituted. As a result, the developed PEC biosensor exhibited a low detection limit down to 0.089 pg mL −1 for the most powerful natural carcinogen aflatoxin M1 (AFM1) assay. Impressively, the target exhibited a completely opposite photocurrent difference to the interfering substances, and the linear correlation coefficient of the assay was improved compared to single-wavelength detection. The PEC sensing platform not only provided a basis for exploring multicharacteristic photoactive material but also innovatively developed the detection mode of the PEC biosensor.