Unveiling the mechanism of the oxygen vacancy modulated photoelectrochemical sensors with high selectivity of the molecules including electron donating groups has become an innovative research field. In this paper, a novel oxygen vacancy modulated BiVO4 photoelectrode (Ov-BiVO4) was fabricated for tetracycline hydrochloride (TC) detection. The Ov-BiVO4 has positive electrostatic potential and can interact with the TC molecules that have a large number of electrons donating groups. A series of experiments confirmed that the formed oxygen vacancies facilitate the adsorption of TC. Based on the good activity of Ov-BiVO4, a wide linear relationship was obtained from 0.1 to 800 nM, with a lower detection limit of 0.17 nM. In addition, the Ov-BiVO4 photoelectrode could detect TC in milk samples with good reliability. Furthermore, density functional theory (DFT) calculations reveal that the oxygen vacancies will widen the depletion layer of BiVO4 and reduce the charge recombination. It is believed that the surface modulation through oxygen vacancies can be extended to other semiconductors for advanced performance in the fields of photoelectrochemical bioanalysis.