Recent studies have revealed that the gut microbiota modulates brain development and behavior, but the underlying mechanisms are still poorly understood. Here, we show that bacterial peptidoglycan (PGN) derived from the commensal gut microbiota can be translocated into the brain and sensed by specific pattern-recognition receptors (PRRs) of the innate immune system. Using expression-profiling techniques, we demonstrate that two families of PRRs that specifically detect PGN (that is, PGN-recognition proteins and NOD-like receptors), and the PGN transporter PepT1 are highly expressed in the developing brain during specific windows of postnatal development in both males and females. Moreover, we show that the expression of several PGN-sensing molecules and PepT1 in the developing striatum is sensitive to manipulations of the gut microbiota (that is, germ-free conditions and antibiotic treatment). Finally, we used the PGN-recognition protein 2 (Pglyrp2) knockout mice to examine the potential influence of PGN-sensing molecules on brain development and behavior. We demonstrate that the absence of Pglyrp2 leads to alterations in the expression of the autism risk gene c-Met, and sex-dependent changes in social behavior, similar to mice with manipulated microbiota. These findings suggest that the central activation of PRRs by microbial products could be one of the signaling pathways mediating the communication between the gut microbiota and the developing brain.