Whereas most animals find urban habitats to be inferior to natural habitats, some “urban specialist” species thrive there. Wormlions present such an example. Common in Mediterranean cities, they cluster in thin layers of loose soil below man-made shelters. Wormlions are fly larvae that dig pit-traps in loose soil and hunt small arthropods. Our first aim was to determine whether wormlion pits accumulate next to walls. Wormlion pits were indeed closer to walls than expected by chance at most of the study sites. We examined possible factors behind this apparent preference, combining field observations and experiments, laboratory work, and theoretical analysis. We examined the effect of soil depth, particle size, shade, and prey abundance. Each factor provided a partial explanation for the wormlions’ proximity to walls, but none provided an overall explanation. We developed a spatially explicit simulation model, demonstrating under which conditions wall-adjacent positions are favored. Finally, we created artificial microhabitats, and placed wormlions either in the center or next to the wall. The wormlions in the center moved over longer distances than those next to the wall and did so more in the wall’s direction. The abundance of walls may help to explain the success of wormlions in urban habitats.