Tropical agroecosystems cover an increasingly large proportion of the Earth's terrestrial surface. Yet, relatively little is known about the factors that influence their avifauna, especially in areas of high human population density. The potential of tropical farmland for sustaining bird biodiversity, including forest birds, can be influenced by habitat structure and the distance from the nearest forest. We investigated the effect of these two factors on the bird community in the farmland near Kakamega Forest, Kenya. Using point counts, we assessed the number of bird species and individuals on 56 study plots in distances up to about 2,100 m from the forest. We observed a total of 96 bird species in the farmland, 22 of which were forest, 58 shrub-land, and 16 open-country species. High vertical vegetation heterogeneity and a large number of woody plant individuals were related to high species richness of forest and shrub-land birds, whereas open-country birds avoided such areas. The species richness and total number of forest birds declined with increasing distance to the forest. A comparison with the bird community within Kakamega Forest indicated that only a fraction of the forest species could be sustained in the farmland. This suggests that agroecosystems with a diverse habitat structure can support a high diversity of birds, but have only a limited capacity to compensate for forest loss.