© 2018 John Wiley & Sons Ltd Host–microbiota mutualism has been established during long-term co-evolution. A diverse and rich gut microbiota plays an essential role in the development and maturation of the host immune system. Education of the adaptive immune compartment by gut microbiota antigens is important in establishing immune balance. In particular, a critical time frame immediately after birth provides a ‘window of opportunity’ for the development of lymphoid structures, differentiation and maturation of T and B cells and, most importantly, establishment of immune tolerance to gut commensals. Depending on the colonization niche, antigen type and metabolic property of different gut microbes, CD4 T-cell responses vary greatly, which results in differentiation into distinct subsets. As a consequence, certain bacteria elicit effector-like immune responses by promoting the production of pro-inflammatory cytokines such as interferon-γ and interleukin-17A, whereas other bacteria favour the generation of regulatory CD4 T cells and provide help with gut homeostasis. The microbiota have profound effects on B cells also. Gut microbial exposure leads to a continuous diversification of B-cell repertoire and the production of T-dependent and -independent antibodies, especially IgA. These combined effects of the gut microbes provide an elegant educational process to the adaptive immune network. Contrariwise, failure of this process results in a reduced homeostasis with the gut microbiota, and an increased susceptibility to various immune disorders, both inside and outside the gut. With more definitive microbial–immune relations waiting to be discovered, modulation of the host gut microbiota has a promising future for disease intervention.