The Drosophila host defense against gram-negative bacteria is mediated by the Imd pathway upon sensing of peptidoglycan by the peptidoglycan recognition protein (PGRP)-LC. Here we report a functional analysis of PGRP-LB, a catalytic member of the PGRP family. We show that PGRP-LB is a secreted protein regulated by the Imd pathway. Biochemical studies demonstrate that PGRP-LB is an amidase that specifically degrades gram-negative bacteria peptidoglycan. In agreement with its amidase activity, PGRP-LB downregulates the Imd pathway. Hence, activation of PGRP-LB by the Imd pathway provides a negative feedback regulation to tightly adjust immune activation to infection. Our study also reveals that PGRP-LB controls the immune reactivity of flies to the presence of ingested bacteria in the gut. Our work highlights the key role of PGRPs that encode both sensors and scavengers of peptidoglycan, which modulate the level of the host immune response to the presence of infectious microorganisms.