Temperate phages are bacterial viruses that as part of their life cycle reside in the bacterial genome as prophages. They are found in many species including most clinical strains of the human pathogens, Staphylococcus aureus and Salmonella enterica serovar Typhimurium. Previously, temperate phages were considered as only bacterial predators, but mounting evidence point to both antagonistic and mutualistic interactions with for example some temperate phages contributing to virulence by encoding virulence factors. Here we show that generalized transduction, one type of bacterial DNA transfer by phages, can create conditions where not only the recipient host but also the transducing phage benefit. With antibiotic resistance as a model trait we used individual-based models and experimental approaches to show that antibiotic susceptible cells become resistant to both antibiotics and phage by i) integrating the generalized transducing temperate phages and ii) acquiring transducing phage particles carrying antibiotic resistance genes obtained from resistant cells in the environment. This is not observed for non-generalized transducing temperate phages, which are unable to package bacterial DNA, nor for generalized transducing virulent phages that do not form lysogens. Once established, the lysogenic host and the prophage benefit from the existence of transducing particles that can shuffle bacterial genes between lysogens and for example disseminate resistance to antibiotics, a trait not encoded by the phage. This facilitates bacterial survival and leads to phage population growth. We propose that generalized transduction can function as a mutualistic trait where temperate phages cooperate with their hosts to survive in rapidly-changing environments. This implies that generalized transduction is not just an error in DNA packaging but is selected for by phages to ensure their survival.