Viruses that infect microbial hosts have traditionally been studied in laboratory settings with a focus on either obligate lysis or persistent lysogeny. In the environment, these infection archetypes are part of a continuum that spans antagonistic to beneficial modes. In this Review, we advance a framework to accommodate the context-dependent nature of virus-microorganism interactions in ecological communities by synthesizing knowledge from decades of virology research, eco-evolutionary theory and recent technological advances. We discuss that nuanced outcomes, rather than the extremes of the continuum, are particularly likely in natural communities given variability in abiotic factors, the availability of suboptimal hosts and the relevance of multitrophic partnerships. We revisit the 'rules of life' in terms of how long-term infections shape the fate of viruses and microbial cells, populations and ecosystems.