Increasing evidence indicates that gut microbiota can influence cognition via the gut-brain axis, and brain networks play a critical role during the process. However, little is known about how brain network topology and structural-functional connectivity (SC-FC) coupling contribute to gut microbiota-related cognition. Fecal samples were collected from 157 healthy young adults, and 16S amplicon sequencing was used to assess gut diversity and enterotypes. Topological properties of brain structural and functional networks were acquired by diffusion tensor imaging (DTI) and resting-state functional magnetic resonance imaging (fMRI data), and SC-FC coupling was further calculated. 3-Back, digit span, and Go/No-Go tasks were employed to assess cognition. Then, we tested for potential associations between gut microbiota, complex brain networks, and cognition. The results showed that gut microbiota could affect the global and regional topological properties of structural networks as well as node properties of functional networks. It is worthy of note that causal mediation analysis further validated that gut microbial diversity and enterotypes indirectly influence cognitive performance by mediating the small-worldness (Gamma and Sigma) of structural networks and some nodal metrics of functional networks (mainly distributed in the cingulate gyri and temporal lobe). Moreover, gut microbes could affect the degree of SC-FC coupling in the inferior occipital gyrus, fusiform gyrus, and medial superior frontal gyrus, which in turn influence cognition. Our findings revealed novel insights, which are essential to provide the foundation for previously unexplored network mechanisms in understanding cognitive impairment, particularly with respect to how brain connectivity participates in the complex crosstalk between gut microbiota and cognition.