Genetic, dietary, and environmental factors concurrently shape the aging process. The aryl hydrocarbon receptor (AhR) was discovered as a dioxin-binding transcription factor involved in the metabolism of different environmental toxicants in vertebrates. Since then, the variety of pathophysiological processes regulated by the AhR has grown, ranging from immune response, metabolic pathways, and aging. Many modulators of AhR activity may impact on aging and age-associated pathologies, but, whether their effects are AhR-dependent has never been explored. Here, using Caenorhabditis elegans, as an elective model organism for aging studies, we show for the first time that lack of CeAHR-1 can have opposite effects on health and lifespan in a context-dependent manner. Using known mammalian AhR modulators we found that, ahr-1 protects against environmental insults (benzo(a)pyrene and UVB light) and identified a new role for AhR-bacterial diet interaction in animal lifespan, stress resistance, and age-associated pathologies. We narrowed down the dietary factor to a bacterially extruded metabolite likely involved in tryptophan metabolism. This is the first study clearly establishing C. elegans as a good model organism to investigate evolutionarily conserved functions of AhR-modulators and -regulated processes, indicating it can be exploited to contribute to the discovery of novel information about AhR in mammals.