Identifying landscapes that are suitable for both biodiversity conservation and agricultural production is a major challenge. Traditionally, much research has focused on biodiversity conservation outside of agricultural production areas, e.g., in semi-natural habitats. In contrast, recent research has mainly focused on the potential of crop heterogeneity. This includes both compositional (crop diversity) and configurational heterogeneity (field border density). However, if and how crop heterogeneity, and semi-natural habitats interact to shape insect diversity in agricultural landscapes remains poorly understood. Here we investigated the combined effects of crop diversity, field border density, and semi-natural habitats (i.e., grassland proportion, hedge density) on insect diversity. We sampled insect communities from 14 – 17 June 2021 with pan traps in 27 study landscapes (500 m x 500 m) covering independent gradients of these landscape variables and identified a total of 587 insect species with DNA metabarcoding. We found that field border density mediated the effects of crop diversity, grassland proportion, and hedge density on insect richness. At low levels of field border density (i.e., landscapes with mostly large fields), effects were either neutral (crop diversity), negative (grassland proportion) or weakly positive (hedge density). By contrast, at high levels of field border density, crop diversity, grassland proportion, and hedge density all exerted positive effects on insect richness. Responses to crop heterogeneity and semi-natural habitat differed among trophic groups of insects (decomposers, herbivores, parasitoids, predators). While variation in richness of herbivorous insects followed the patterns of the overall richness, decomposer richness was not related to any of the investigated variables. Predator richness increased with hedge density in landscapes, whereas parasitoid richness increased when high levels of field border density and grassland proportion coincided. Our study shows that increasing crop heterogeneity is a viable strategy for promoting insect diversity in agricultural landscapes. However, the effects of the amount of remaining semi-natural habitats, such as grassland or hedges, are mediated by configurational heterogeneity, and vary between trophic groups. Efforts to conserve insects in agricultural landscapes must therefore focus on both increasing the heterogeneity of the crop matrix by promoting crop diversity and increasing the density of field borders, while also maintaining or restoring semi-natural habitats as important source habitats for insect species.