A ternary BiVO4/Ag/g-C3N4 composite was constructed by photodeposition and hydrothermal reactions, and was applied for the photocatalytic inactivation of E. coli cells in synthetic water (saline solution) and sewage. The ternary BiVO4/Ag/g-C3N4 showed significantly enhanced photocatalytic disinfection activity, achieving 6.5-log E. coli inactivation in 60 min, while binary BiVO4/g-C3N4 only inactivated 0.5-log of E. coli cells within 60 min under visible light irradiation. As proven by the reactive species, electrochemical characterization and photoluminescence spectra, Ag promoted the interfacial electron transfer, effectively suppressed the recombination of electron-hole pairs, and boosted reactive species generation in the BiVO4/Ag/g-C3N4 photocatalytic process. The Z-scheme charge transfer mode with Ag as an electron mediator was also proposed for BiVO4/Ag/g-C3N4 based on the band levels and surface reactions. Moreover, photocatalytic disinfection by BiVO4/Ag/g-C3N4 was investigated in an authentic sewage sample obtained from a local wastewater treatment plant. Inhibited disinfection activity of BiVO4/Ag/g-C3N4 was observed in sewage in comparison with that in synthetic saline solution. By mimicking the components of sewage individually, natural organic matter (NOM) was found to be the dominant component that decreased the photocatalytic disinfection activity in sewage. Through excitation-emission matrix fluorescence spectroscopy and X-ray photoelectron spectroscopy, the mechanistic study revealed that NOM could compete with E. coli cells for reactive species and be adsorbed onto the surface of the photocatalyst, thus hindering the disinfection in sewage. This study can provide insights into developing heterojunction photocatalysts for disinfection, as well as deepening the understanding of photocatalysts as applied for treating wastewater.