Research on biodiversity and ecosystem functioning has demonstrated links between plant diversity and ecosystem functions such as productivity. At other trophic levels, the plant microbiome has been shown to influence host plant fitness and function, and host-associated microbes have been proposed to influence ecosystem function through their role in defining the extended phenotype of host organisms However, the importance of the plant microbiome for ecosystem function has not been quantified in the context of the known importance of plant diversity and traits. Here, using a tree biodiversity-ecosystem functioning experiment, we provide strong support for the hypothesis that leaf bacterial diversity is positively linked to ecosystem productivity, even after accounting for the role of plant diversity. Our results also show that host species identity, functional identity and functional diversity are the main determinants of leaf bacterial community structure and diversity. Our study provides evidence of a positive correlation between plant-associated microbial diversity and terrestrial ecosystem productivity, and a new mechanism by which models of biodiversity-ecosystem functioning relationships can be improved. © 2017 Macmillan Publishers Limited, part of Springer Nature. All rights reserved.