Understanding the trade-offs between biodiversity conservation and agricultural production has become a fundamental question in sustainability science. Substantial research has focused on how species' populations respond to agricultural intensification, with the goal to understand whether conservation policies that spatially separate agriculture and conservation or, alternatively, integrate the two are more beneficial. Spatial heterogeneity in both species abundance and agricultural productivity have been largely left out of this discussion, although these patterns are ubiquitous from local to global scales due to varying land capacity. Here, we address the question of how to align agricultural production and biodiversity conservation in heterogeneous landscapes. Using model simulations of species abundance and agricultural yields, we show that trade-offs between agricultural production and species' abundance can be reduced by minimizing the cost (in terms of species abundance) of agricultural production. We find that when species' abundance and agricultural yields vary across landscapes, the optimal strategy to minimize trade-offs is rarely pure land sparing or land sharing. Instead, landscapes that combine elements of both strategies are optimal. Additionally, we show how the reference population of a species is defined has important influences on optimization results. Our findings suggest that in the real world, understanding the impact of heterogeneous land capacity on biodiversity and agricultural production is crucial to designing multi-use landscapes that jointly maximize conservation and agricultural benefits.