The gut microbiota plays crucial roles in the development and functions of the central nervous system (CNS) as well as in modulation of neurobehavior in heath and disease. The gut brush border enzyme intestinal alkaline phosphatase (IAP) is an important positive regulator of gut microbial homeostasis. In mice, IAP is encoded by Akp3 gene, which is specifically expressed in the duodenum of the small intestine. IAP deficiency alters gut bacterial composition and gut barrier function. Decreased IAP activity has been observed in aging, gut inflammatory diseases, and metabolic disorders. We hypothesized that this enzyme could also play an important role in modulating neurobehavior. We performed deep sequencing of gut bacterial 16S rRNA and found that IAP deficiency changed gut microbiota composition at various taxonomic levels. Using targeted metabolomic analysis, we also found that IAP deficiency resulted in changes of gut bacteria-derived metabolites in serum and brain metabolism. Neurobehavioral analyses revealed that Akp3-/- (IAP knockout) mice had decreased basal nociception thresholds, increased anxiety-like behavior, and reduced locomotor activity. Furthermore, Akp3-/- mice had more pronounced brain microglial phagocytic activity, together with an increase in the activated microglia population. Fecal microbiota transplantation from wildtype to Akp3-/- mice partially improved neurobehavior and reduced brain microglial phagocytic activity in Akp3-/- mice. This study demonstrates that deficiency of the endogenous gut-derived host factor IAP induces behavioral phenotype changes (nociception; motor activity, and anxiety) and affects brain microglia activity. Changes in the gut microbiota induced by knocking down Akp3 contribute to behavioral changes, which is probably mediated by microglia activity modulated by the gut bacteria-derived metabolites.