While microbial phosphate removal in activated sludge (AS) systems has been extensively studied, the role of viruses in this process remains largely unexplored. In this study, we identified 149 viral auxiliary metabolic genes associated with phosphorus cycling from 2,510 viral contigs (VCs) derived from AS systems. Notably, polyphosphate kinase 1 (ppk1) and polyphosphate kinase 2 (ppk2) genes, which are primarily responsible for phosphate removal, were found in five unclassified VCs. These genes exhibited conserved protein structures and active catalytic sites, indicating a pivotal role of viruses in enhancing phosphorus removal. Phylogenetic analysis demonstrated a close relationship between viral ppk genes and their bacterial counterparts, suggesting the occurrence of horizontal gene transfer. Furthermore, experimental assays validated that viral ppk genes enhanced host phosphate removal capabilities. VCs carrying ppk genes were observed across diverse ecological and geographical contexts, suggesting their potential to bolster host functions in varied environmental and nutrient settings, spanning natural and engineered systems. These findings uncover a previously underappreciated mechanism by which viruses enhance phosphate removal in wastewater treatment plants. Overall, our study highlights the potential for leveraging virus-encoded genes to improve the efficiency of biological phosphorus removal processes, offering new insights into the microbial ecology of AS systems and the role of viruses in biogeochemical cycling.