Phages are increasingly recognized as important members of host-associated microbiomes, with a vast genomic diversity. The new frontier is to understand how phages may affect higher order processes, such as in the context of host-microbe interactions. Here, we use marine sponges as a model to investigate the interplay between phages, bacterial symbionts, and eukaryotic hosts. Using viral metagenomics, we find that sponges, although massively filtering seawater, harbor species-specific and even individually unique viral signatures that are taxonomically distinct from other environments. We further discover a symbiont phage-encoded ankyrin-domain-containing protein, which is widely spread in phages of many host-associated contexts including human. We confirm in macrophage infection assays that the ankyrin protein (ANKp) modulates the eukaryotic host immune response against bacteria. We predict that the role of ANKp in nature is to facilitate coexistence in the tripartite interplay between phages, symbionts, and sponges and possibly many other host-microbe associations.