Bacteria are central to human health and disease, but existing tools to edit microbial consortia are limited. For example, broad-spectrum antibiotics are unable to accurately manipulate bacterial communities. Bacteriophages can provide highly specific targeting of bacteria, but assembling well-defined phage cocktails solely with natural phages can be a time-, labor- and cost-intensive process. Here, we present a synthetic-biology strategy to modulate phage host ranges by engineering phage genomes in Saccharomyces cerevisiae. We used this technology to redirect Escherichia coli phage scaffolds to target pathogenic Yersinia and Klebsiella bacteria, and conversely, Klebsiella phage scaffolds to target E. coli by modular swapping of phage tail components. The synthetic phages achieved efficient killing of their new target bacteria and were used to selectively remove bacteria from multi-species bacterial communities with cocktails based on common viral scaffolds. We envision that this approach will accelerate phage-biology studies and enable new technologies for bacterial population editing.