Autism spectrum disorder (ASD) manifests as alterations in complex human behaviors including social communication and stereotypies. In addition to genetic risks, the gut microbiome differs between typically developing (TD) and ASD individuals, though it remains unclear whether the microbiome contributes to symptoms. We transplanted gut microbiota from human donors with ASD or TD controls into germ-free mice and reveal that colonization with ASD microbiota is sufficient to induce hallmark autistic behaviors. The brains of mice colonized with ASD microbiota display alternative splicing of ASD-relevant genes. Microbiome and metabolome profiles of mice harboring human microbiota predict that specific bacterial taxa and their metabolites modulate ASD behaviors. Indeed, treatment of an ASD mouse model with candidate microbial metabolites improves behavioral abnormalities and modulates neuronal excitability in the brain. We propose that the gut microbiota regulates behaviors in mice via production of neuroactive metabolites, suggesting that gut-brain connections contribute to the pathophysiology of ASD.