Bacteriophage ecology involves the study of the viruses that infect bacteria and how these viruses interact with their environments. In this article, we review how phage interact with their environments across the basic units of ecological organization, including populations, communities, and ecosystems. Within populations, phage face the fitness consequences of competition via direct and indirect interactions with other individuals, and here we focus on the molecular adaptions of phage to compete for their key resource, host cells. Within communities, phage influence the dynamics of their bacterial hosts and other trophic levels, and we discuss the contributions of phage biology to the general development of ecology and evolutionary biology. At the ecosystem level, phage mediate biological feedbacks through the rapid production of dissolved organic material. The many interactions between phage and their environments have resulted in incredibly diverse phage communities, and we review the measurement of phage genetic and morphological diversity, highlighting the different replication strategies employed by phage.