1. Interspecific niche differences have long been identified as a major explanation for the occurrence of species-rich communities. However, much fieldwork studying variation in local species richness has focused upon physical habitat attributes or regional factors, such as the size of the regional species pool. 2. We applied indices of functional diversity and niche overlap to data on the species niche to examine the importance of interspecific niche differentiation for species richness in French lake fish communities. We combined this information with environmental data to test generalizations of the physiological tolerance and niche specialization hypotheses for species-energy relationships. 3. We found evidence for a largely non-saturating relationship (relative to random expectation) between species richness and functional evenness (evenness of spacing between species in niche space), while functional richness (volume of niche space occupied) peaked at moderate levels of species richness and niche overlap showed an initial decrease followed by saturation. This suggests that increased niche specialization may have allowed species to coexist in the most species-rich communities. 4. We tested for evidence that increased temperature, local habitat area, local habitat diversity and immigration affected species richness via increased niche specialization. Temperature explained by far the largest amount of variation in species richness, functional diversity and niche overlap. These results, combined with the largely non-saturating species richness-functional evenness relationship, suggest that increased temperature may have permitted increased species richness by allowing increased niche specialization. 5. These results emphasize the importance of niche differences for species coexistence in species-rich communities, and indicate that the conservation of functional diversity may be vital for the maintenance of species diversity in biological communities. Our approach may be applied readily to many types of community, and at any scale, thus providing a flexible means of testing niche-based hypotheses for species richness gradients.