Bacteria can be genetically engineered to kill specific pathogens or inhibit their virulence. We previously developed a synthetic genetic system that allows a laboratory strain of Escherichia coli to sense and kill Pseudomonas aeruginosa in vitro. Here, we generate a modified version of the system, including a gene encoding an anti-biofilm enzyme, and use the probiotic strain Escherichia coli Nissle 1917 as host. The engineered probiotic shows in vivo prophylactic and therapeutic activity against P. aeruginosa during gut infection in two animal models (Caenorhabditis elegans and mice). These findings support the further development of engineered microorganisms with potential prophylactic and therapeutic activities against gut infections.