This paper studies how farmers’ participation in non-local markets shapes agricultural productivity. Using farm-level data from Colombia, we document two empirical patterns about the spatial organization of agriculture. First, across municipalities, better access to urban centers increases farmers’ productivity and participation in non-local markets, but reduces farm size. Second, within municipalities and crop-choices, larger farms participate more in non-local markets and have higher productivity. To rationalize these patterns, we introduce farmers with heterogeneous productivity and market participation choices into a spatial economy model. We take the model to data and find that removing the geographic barriers to farmers’ participation in non-local markets can increase Colombia's agricultural value added by up to 14%. Changes in the productivity composition of farmers contribute substantially to this impact, particularly in remote regions with low participation of farmers in non-local markets.