Abstract Background Viruses play important roles in the ocean’s biogeochemical cycles. Yet, deep ocean viruses are one of the most under-explored fractions of the global biosphere. Little is known about the environmental factors that control the composition and functioning of their communities or how they interact with their free-living or particle-attached microbial hosts. Results We analysed 58 viral communities associated with size-fractionated free-living (0.2–0.8 μm) and particle-attached (0.8–20 μm) cellular metagenomes from bathypelagic (2150–4018 m deep) microbiomes obtained during the Malaspina expedition. These metagenomes yielded 6631 viral sequences, 91% of which were novel, and 67 represented high-quality genomes. Taxonomic classification assigned 53% of the viral sequences to families of tailed viruses from the order Caudovirales. Computational host prediction associated 886 viral sequences to dominant members of the deep ocean microbiome, such as Alphaproteobacteria (284), Gammaproteobacteria (241), SAR324 (23), Marinisomatota (39), and Chloroflexota (61). Free-living and particle-attached viral communities had markedly distinct taxonomic composition, host prevalence, and auxiliary metabolic gene content, which led to the discovery of novel viral-encoded metabolic genes involved in the folate and nucleotide metabolisms. Water mass age emerged as an important factor driving viral community composition. We postulated this was due to changes in quality and concentration of dissolved organic matter acting on the host communities, leading to an increase of viral auxiliary metabolic genes associated with energy metabolism among older water masses. Conclusions These results shed light on the mechanisms by which environmental gradients of deep ocean ecosystems structure the composition and functioning of free-living and particle-attached viral communities.