Most infections induce anorexia but its function, if any, remains unclear. Because this response is common among animals, we hypothesized that infection-induced diet restriction might be an adaptive trait that modulates the host's ability to fight infection. Two defense strategies protect hosts against infections: resistance, which is the ability to control pathogen levels, and tolerance, which helps the host endure infection-induced pathology. Here we show that infected fruit flies become anorexic and that diet restriction alters defenses, increasing the fly's tolerance to Salmonella typhimurium infections while decreasing resistance to Listeria monocytogenes. This suggests that attempts to extend lifespan through diet restriction or the manipulation of pathways mimicking this process will have complicated effects on a host's ability to fight infections.