In this article, the fabrication and characterization of a photoelectrochemical (PEC) rifampicin sensor based on graphene oxide grafted with Ni tetraamino phthalocyanine was described, which presents an excellent PEC activity, sensitivity, and material stability. The synthesized graphene oxide grafted with Ni tetraamino phthalocyanine was characterized using ultraviolet–visible (UV–vis), Fourier transform infrared (FTIR), scanning electron microscopy (SEM), and transmission electron microscopy (TEM) analyses. Specifically, detection for rifampicin was based on the reduction of photocurrent caused by binding of the analyte to the sensing electrode surface. The fabricated sensor was characterized in a broad linear response range (0.025–71.3 μM) and with a low detection limit (2.5 nM), outperforming the previously reported sensors and thus being well suited for quality control and other applications, as confirmed by successful real‐life sample testing.