Homegardens are conservation units for native plants and reservoirs of exotic species from different origins. We analysed the species composition and diversity of edible plants on three groups of homegardens in a gradient from urban to rural situations, but under the same historical and cultural contexts, and verified how these homegardens can favour the conservation of plants from different origins. The size of each homegarden was measured and complete inventories were carried out to assess the total edible plant diversity. Plants were collected for taxonomic identification or identified in the field, and were classified for their biogeographic origin. We compared species richness and diversity among the groups of homegardens (urban, periurban and rural), and analysed their floristic similarity. A total of 109 homegardens were studied (39 urban, 60 periurban, and 10 rural). We registered a total of 101 species, 45 botanical families and 41 varieties, with 71% of the species occurring in less than 10% of the homegardens. Rural homegardens were more diverse than periurban ones, and periurban and urban homegardens are equally diverse. We found a low but significant correlation between floristic similarity and geographic distance to the urban area. Most plants were introduced, with different origins, especially from South America Lowlands. A significant amount of plants were exchanged between relatives and neighbours. These homegardens can be considered agrobiodiversity reservoirs in a micro-regional scale, being important areas for in situ and on farm conservation and including native and exotic plants.