The endocrine system employs peptide hormone signals to translate environmental changes into physiological responses. The diffuse endocrine system embedded in the gastrointestinal barrier epithelium is one of the largest and most diverse endocrine tissues. Furthermore, it is the only endocrine tissue in direct physical contact with the microbial environment of the gut lumen. However, it remains unclear how this sensory epithelium responds to specific pathogenic challenges in a dynamic and regulated manner. We demonstrate that the enteroendocrine cells of the adult Drosophila melanogaster midgut display a transient, sensitive, and systemic induction of the prosecretory factor dimmed (dimm) in response to the Gram-negative pathogen Pseudomonas entomophila (Pe). In enteroendocrine cells, dimm controls the levels of the targets Phm, dcat-4, and the peptide hormone, Allatostatin A. Finally, we identify dimm as a host factor that protects against Pe infection and controls the expression of antimicrobial peptides. We propose that dimm provides "gain" in enteroendocrine output during the adaptive response to episodic pathogen exposure.