Abstract Background Porous environments constitute ubiquitous microbial habitats across natural, engineered, and medical settings, offering extensive internal surfaces for biofilm development. While the physical structure of the porous environment is known to shape the spatial organization of biofilm inhabitants and their interspecific interactions, its influence on biofilm community structure and functional diversity remains largely unknown. This study employed microfluidic chips with varying micropillar diameters to create distinct pore spaces that impose different levels of spatial constraints on biofilm development. The impact of pore spaces on biofilm architecture, community assembly, and metabolic functions was investigated through in situ visualization and multi-omics technologies. Results Larger pore sizes were found to increase biofilm thickness and roughness while decreasing biofilm coverage over pore spaces. An increase in pore size resulted in reduced biofilm community evenness and increased phylogenetic diversity. Remarkably, biofilms in 300-μm pore spaces displayed the highest richness and the most complex and interconnected co-occurrence network pattern. The neutral model analysis demonstrated that biofilm assembly within different pore spaces was predominantly governed by stochastic processes, while deterministic processes became more influential as pore space increased. Exometabolomic analyses of effluents from the microfluidic chips further elucidated a significant correlation between the exometabolite profiles and biofilm community structure. The increased community richness in the 300-μm pore space was associated with the significantly higher exometabolome diversity. Conclusions Collectively, our results indicate that increased pore space, which alleviated spatial constraints on biofilm development, resulted in the formation of thicker biofilms with enhanced phylogenetic and functional diversity. Your browser is not supporting the HTML5