A novel photoelectrochemical (PEC) aptasensor for diclofenac detection, based on visible/near-infrared (vis/NIR) light-responsive vanadyl-phthalocyanine/graphitic carbon nitrid nanosheet (VOPc/CN) nanocomposites, was successfully fabricated. In this work, the first coupling of CN and VOPc with a facile solution–phase method was prepared and applied to PEC sensing. The UV–vis diff ;use reflection spectra (DRS) indicated that VOPc is an excellent photosensitizer when applied to the surface of CN. It promoted CN light absorption to the visible-NIR region, which greatly enhanced the light excitation capability. The PEC signal of the VOPc/CN nanocomposites improved 2.7 and 12.42-fold compared with pure VOPc and CN, respectively, indicating that VOPc/CN nanocomposites have good photoelectric activity and enhanced photo-to-current conversion efficiency. As a result, VOPc sensitized CN was introduced as a covalent immobilizing PEC aptasensor for the sensitive and selective determination of diclofenac (DCF). Under optimal conditions, the fabricated PEC biosensor exhibited good PEC performances with high sensitivity, a low detection limit of 0.03 nM (S/N = 3) and a wide linear response, in the range of 0.1-500 nM. This was due to the specific interaction between DCF and the aptamer. It is concluded that VOPc/CN nanocomposites are potentially promising photoactive materials for applications in PEC biosensors, as well as for photocatalysis and other related fields.