Interactions between top predators and mesopredators of the same guild often result in habitat segregation restricting interactions to shared habitat edges. Although negative edge effects are recognized as important spatial patterns in the ecology of fragmented landscapes, the underlying mechanisms of predator–prey interactions resulting in negative edge effects remain unknown. To disentangle top-down effects of intraguild predators and bottom-up effects of shared resources on mesopredator spatial distribution, we recorded the occurrence of tawny owls Strix aluco in forests and their prey, the little owl Athene noctua in adjacent open areas over 2 yr across 687 km2 in Southern Germany. We developed a new, asymmetrical dynamic two-species occupancy model investigating spatial interactions while accounting for imperfect detection. Little owl occupancy was strongly reduced within 150 m of forests, but only in the presence of tawny owls. Analysis of over 30 000 telemetry locations of 275 little owls showed that little owls strongly avoided areas closer than 150 m from the forest during range use. These results suggest that the negative edge effect is due to forest edge avoidance rather than direct predation. Potential confounding mechanisms such as food depletion or habitat avoidance at forest edges can be ruled out. Thus, top-down effects caused by avoidance of intraguild top predators shape the spatial distribution of mesopredators such as the little owl. While habitat complexity mitigates multitrophic interactions within habitats, it is expected to reinforce multitrophic interactions between habitats, potentially leading to the suppression of mesopredators from suitable habitats.