The microbial community in the gut is influenced by environmental factors, especially diet, which can moderate host behaviour through the microbiome-gut-brain axis. However, the ecological relevance of microbiome-mediated behavioural plasticity in wild animals is largely unexplored. We presented wild-caught great tits ( Parus major ) with a problem-solving task and showed that performance was weakly associated with natural variation in the gut microbiome. We then manipulated the gut microbiome by feeding birds one of two diets that differed in their relative levels of fat, protein and fibre content: an insect only diet (low content), or a seed, nut and beef suet diet (high content). We presented these same individuals with the same problem solving task after the dietary manipulation to test whether any observed dietary-induced gut microbiome alterations predicted their subsequent problem solving performance. Microbial communities changed substantially and were less diverse among individuals given the insect but not the seed diet. Individuals were less likely to problem-solve after being given the insect diet, and problem-solving performance was positively associated with microbiome diversity. The same microbiota metrics that were altered as a consequence of diet were also those that correlated with variation in problem solving performance. Although the effect on behaviour may not be solely or directly a consequence of the gut microbiota manipulation, this nevertheless represents the first evidence for an association between behaviour, diet and the gut microbiome in a wild animal system, and points to an overlooked but potentially crucial mechanism underlying individual behavioural plasticity in evolutionary ecology.