Bacteria adapt themselves to host environments by altering the pattern of gene expression. The promoter-recognizing subunit σ of bacterial RNA polymerase plays a major role in the selection of genes to be transcribed. Among seven σ factors of Escherichia coli, σ(38) is responsible for the transcription of genes in the stationary phase and under stressful conditions. We found a transient increase of σ(38) when E. coli was injected into the hemocoel of Drosophila melanogaster. The loss of σ(38) made E. coli rapidly eliminated in flies, and flies infected with σ(38)-lacking E. coli stayed alive longer than those infected with the parental strain. This was also observed in fly lines defective in humoral immune responses, but not in flies in which phagocytosis was impaired. The lack of σ(38) did not influence the susceptibility of E. coli to phagocytosis, but made them vulnerable to killing after engulfment. The changes caused by the loss of σ(38) were recovered by the forced expression of σ(38)-encoding rpoS as well as σ(38)-regulated katE and katG coding for enzymes that detoxify reactive oxygen species. These results collectively suggested that σ(38) contributes to the prolonged survival of E. coli in Drosophila by inducing the production of enzymes that protect bacteria from killing in phagocytes. Considering the similarity in the mechanism of innate immunity against invading bacteria between fruit flies and humans, the products of these genes could be new targets for the development of more effective antibacterial remedies.