Bacteriophages (phages) play a vital role in ecosystem functions by influencing the composition, genetic exchange, metabolism, and environmental adaptation of microbial communities. With recent advances in sequencing technologies and bioinformatics, our understanding of the ecology and evolution of phages in stressful environments has substantially expanded. Here, we review the impact of physicochemical environmental stress on the physiological state and community dynamics of phages, the adaptive strategies that phages employ to cope with environmental stress, and the ecological effects of phage–host interactions in stressful environments. Specifically, we highlight the contributions of phages to the adaptive evolution and functioning of microbiomes and suggest that phages and their hosts can maintain a mutualistic relationship in response to environmental stress. In addition, we discuss the ecological consequences caused by phages in stressful environments, encompassing biogeochemical cycling. Overall, this review advances an understanding of phage ecology in stressful environments, which could inform phage-based strategies to improve microbiome performance and ecosystem resilience and resistance in natural and engineering systems.