Pollination by bees and other animals increases the size, quality, or stability of harvests for 70% of leading global crops. Because native species pollinate many of these crops effectively, conserving habitats for wild pollinators within agricultural landscapes can help maintain pollination services. Using hierarchical Bayesian techniques, we synthesize the results of 23 studies - representing 16 crops on five continents - to estimate the general relationship between pollination services and distance from natural or semi-natural habitats. We find strong exponential declines in both pollinator richness and native visitation rate. Visitation rate declines more steeply, dropping to half of its maximum at 0.6 km from natural habitat, compared to 1.5 km for richness. Evidence of general decline in fruit and seed set - variables that directly affect yields - is less clear. Visitation rate drops more steeply in tropical compared with temperate regions, and slightly more steeply for social compared with solitary bees. Tropical crops pollinated primarily by social bees may therefore be most susceptible to pollination failure from habitat loss. Quantifying these general relationships can help predict consequences of land use change on pollinator communities and crop productivity, and can inform landscape conservation efforts that balance the needs of native species and people.