Polymeric carbon nitrides (pCN) have garnered immense attention, ranging from super-hard materials to artificial photosynthesis, due to their exceptional chemical and optoelectronic properties. The most studied C3N4 along with other stoichiometric pCN, such as C3N, C2N and C3N5, commonly employed a six-membered ring as the basic units; while the five-membered rings are also popular in a myriad of natural and artificial molecules with a more polarized framework and intriguing functionalities. Here, we report a facile synthesis of C3N2 with a topological structure of five-membered rings, endowing by far the narrowest the first electronic transition energy (0.81 eV) in pCN family. The basic imidazole unit with dangling bonds, resulting in an unusual electronic band of p-π conjugation and split molecular orbitals, was revealed in C3N2 by both experiments and density functional theory calculations. Moreover, a NIR-responsive photoelectrochemical (PEC) biosensor for non-transparent biosamples was constructed for the first time using C3N2 with outstanding performance. This work would not only open a new vista of pCN with different topological structures but also broaden the horizon of their application, such as prospective in vivo PEC bioassay.