For over 300 million years, insects have relied on symbiotic microbes for nutrition and defence. However, it is unclear whether specific ecological conditions have repeatedly favoured the evolution of symbioses, and how this has influenced insect diversification. Here, using data on 1,850 microbe–insect symbioses across 402 insect families, we found that symbionts have allowed insects to specialize on a range of nutrient-imbalanced diets, including phloem, blood and wood. Across diets, the only limiting nutrient consistently associated with the evolution of obligate symbiosis was B vitamins. The shift to new diets, facilitated by symbionts, had mixed consequences for insect diversification. In some cases, such as herbivory, it resulted in spectacular species proliferation. In other niches, such as strict blood feeding, diversification has been severely constrained. Symbioses therefore appear to solve widespread nutrient deficiencies for insects, but the consequences for insect diversification depend on the feeding niche that is invaded.