Covalent organic frameworks (COFs) exhibit excellent photoelectrically active structures and serve as channels for photon capture and charge carrier transport. However, their relatively high charge-carrier recombination rates and lack of specific recognition sites limit their application in photoelectrochemical sensing. This paper reports a functionalized donor–acceptor (D-A) COF comprising electron-rich polycyclic aromatic moieties and electron-deficient triazines (Tz) incorporating boronic acid through ligand exchange. The number of aromatic rings in the polycyclic aromatic moiety is crucial for establishing an efficient D-A system within COF. In the absence of an external electron donor, the anthracene-based COF exhibited a five-fold enhancement in photocurrent compared to the naphthalene-based COF. The resulting anthracene-based D-A COF exhibited enhanced orbital overlap and electron push–pull interactions, facilitating more effective charge separation. Furthermore, introducing boronic acid enabled the selective enrichment of low-concentration external electron donors, such as dopamine, in the inner Helmholtz plane. This ingenious approach establishes a unique dual-channel D-A system that allows direct measurement of dopamine in serum. Under optimized conditions, the test platform achieves good correspondence for dopamine at 1 to 100 nM and 0.5 to 100 μM with a detecting limit of 0.36 nM (3σ/S, n = 11). This strategy introduces a novel dimension to photoelectrochemical sensing, focusing on the effect of spatial separation between the external electron donor and the photoelectrode interface that intricately shapes the behavior and enhances the performance of the photoelectric system.