Biological tissues, sediments, or engineered systems are spatially structured media with a tortuous and porous structure that host the flow of fluids. Such complex environments can influence the spatial and temporal colonization patterns of bacteria by controlling the transport of individual bacterial cells, the availability of resources, and the distribution of chemical signals for communication. Yet, due to the multi-scale structure of these complex systems, it is hard to assess how different biotic and abiotic properties work together to control the accumulation of bacterial biomass. Here, we explore how flow-mediated interactions allow the gut commensal Escherichia coli to colonize a porous structure that is composed of heterogenous dead-end pores (DEPs) and connecting percolating channels, i.e. transmitting pores (TPs), mimicking the structured surface of mammalian guts. We find that in presence of flow, gradients of the quorum sensing (QS) signaling molecule autoinducer-2 (AI-2) promote E. coli chemotactic accumulation in the DEPs. In this crowded environment, the combination of growth and cell-to-cell collision favors the development of suspended bacterial aggregates. This results in hot-spots of resource consumption, which, upon resource limitation, triggers the mechanical evasion of biomass from nutrients and oxygen depleted DEPs. Our findings demonstrate that microscale medium structure and complex flow coupled with bacterial quorum sensing and chemotaxis control the heterogenous accumulation of bacterial biomass in a spatially structured environment, such as villi and crypts in the gut or in tortuous pores within soil and filters.