Increasing evidence points to a potential negative impact of pesticides on wild bee and bumblebee populations. However, without the means of disease control it would be difficult to produce enough crops to satisfy demand. How should farmers balance these two possibly incompatible and yet essential inputs? In this paper, we combine ecological modelling with economic analysis to investigate the effects of pesticide use on wild and commercial bees, whilst allowing farmers to partly offset the negative effects of pesticides on bee populations by creating more on-farm bee habitat. The optimal allocation of on-farm habitat strongly depends on the negative effects of pesticides, with a threshold-like behaviour at a critical level of the impairment. When this threshold is crossed, the population of wild bees becomes locally extinct and their availability to pollinate breaks down. We show that availability of commercial bees masks this decrease in pollination services which would otherwise incentivise farmers to conserve the wild pollinator population. Indeed, if commercial bees are available, optimum profit may be achieved by providing no habitat at all for wild bees, and allowing these wild pollinators to go extinct.