The uropygial gland of birds secretes wax that is applied to the plumage, where the secretions are hypothesized to eliminate fungi and bacteria, thereby potentially providing important benefits in terms of plumage maintenance. We analyzed variation in size of the uropygial gland in 212 species of birds to determine the function and the ecological correlates of variation in gland size. Bird species with larger uropygial glands had more genera of chewing lice of the sub-order Amblycera, but not of the sub-order Ischnocera, and more feather mites. There was a fitness advantage associated with relatively large uropygial glands because such species had higher hatching success. These findings are consistent with the hypothesis that the uropygial gland functions to manage the community of microorganisms, and that certain taxa of chewing lice have diverged as a consequence of these defenses.