Most animal traps are constructed from self-secreted silk, so antlions are rare among trap builders because they use only materials found in the environment. We show how antlions exploit the properties of the substrate to produce very effective structures in the minimum amount of time. Our modelling demonstrates how antlions: (i) exploit self-stratification in granular media differentially to expose deleterious large grains at the bottom of the construction trench where they can be ejected preferentially, and (ii) minimize completion time by spiral rather than central digging. Both phenomena are confirmed by our experiments. Spiral digging saves time because it enables the antlion to eject material initially from the periphery of the pit where it is less likely to topple back into the centre. As a result, antlions can produce their pits—lined almost exclusively with small slippery grains to maximize powerful avalanches and hence prey capture—much more quickly than if they simply dig at the pit's centre. Our demonstration, for the first time to our knowledge, of an animal using self-stratification in granular media exemplifies the sophistication of extended phenotypes even if they are only formed from material found in the animal's environment.