Agricultural intensification has increased crop yields, but at high economic and environmental cost. Harnessing ecosystem services of naturally occurring organisms is a cheaper but under-appreciated approach, because the functional roles of organisms are not linked to crop yields, especially outside the northern temperate zone. Ecosystem services in soil come from earthworms in these cooler and wetter latitudes; what may fulfill their functional role in agriculture in warmer and drier habitats, where they are absent, is unproven. Here we show in a field experiment that ants and termites increase wheat yield by 36% from increased soil water infiltration due to their tunnels and improved soil nitrogen. Our results suggest that ants and termites have similar functional roles to earthworms, and that they may provide valuable ecosystem services in dryland agriculture, which may become increasingly important for agricultural sustainability in arid climates.