Immunoglobulin A (IgA) maintains a symbiotic equilibrium with intestinal microbes. IgA induction in the gut-associated lymphoid tissues (GALTs) is dependent on microbial sampling and cellular interaction in the subepithelial dome (SED). However it is unclear how IgA induction is predominantly initiated in the SED. Here we show that previously unrecognized mesenchymal cells in the SED of GALTs regulate bacteria-specific IgA production and diversify the gut microbiota. Mesenchymal cells expressing the cytokine RANKL directly interact with the gut epithelium to control CCL20 expression and microfold (M) cell differentiation. The deletion of mesenchymal RANKL impairs M cell-dependent antigen sampling and B cell-dendritic cell interaction in the SED, which results in a reduction in IgA production and a decrease in microbial diversity. Thus, the subepithelial mesenchymal cells that serve as M cell inducers have a fundamental role in the maintenance of intestinal immune homeostasis.