Gut microbiota plays important roles in host metabolism. Whether and how much the gut microbiota in different gut locations contributes to the variations of host serum metabolites are largely unknown, because it is difficult to obtain microbial samples from different gut locations on a large population scale. Here, we quantified the gut microbial compositions using 16S rRNA gene sequencing for 1070 samples collected from the ileum, cecum and faeces of 544 F6 pigs from a mosaic pig population. Untargeted metabolome measurements determined serum metabolome profiles. We found 1671, 12,985 and 103,250 significant correlations between circulating serum metabolites and bacterial ASVs in the ileum, cecum, and faeces samples. We detected nine serum metabolites showing significant correlations with gut bacteria in more than one gut location. However, most metabolite-microbiota pairwise associations were gut location-specific. Targeted metabolome analysis revealed that CDCA, taurine, L-leucine and N-acetyl-L-alanine can be used as biomarkers to predictporcine fatness. Enriched taxa in fat pigs, for example Prevotella and Lawsonia intracellularis were positively associated with L-leucine, while enriched taxa in lean pigs, such as Clostridium butyricum, were negatively associated with L-leucine and CDCA, but positively associated with taurine and N-acetyl-L-alanine. These results suggested that the contributions of gut microbiota in each gut location to the variations of serum metabolites showed spatial heterogeneity.