The core symptoms of many neurological disorders have traditionally been thought to be caused by genetic variants affecting brain development and function. However, the gut microbiome, another important source of variation, can also influence specific behaviors. Thus, it is critical to unravel the contributions of host genetic variation, the microbiome, and their interactions to complex behaviors. Unexpectedly, we discovered that different maladaptive behaviors are interdependently regulated by the microbiome and host genes in the Cntnap2-/- model for neurodevelopmental disorders. The hyperactivity phenotype of Cntnap2-/- mice is caused by host genetics, whereas the social-behavior phenotype is mediated by the gut microbiome. Interestingly, specific microbial intervention selectively rescued the social deficits in Cntnap2-/- mice through upregulation of metabolites in the tetrahydrobiopterin synthesis pathway. Our findings that behavioral abnormalities could have distinct origins (host genetic versus microbial) may change the way we think about neurological disorders and how to treat them.