The impact of human milk oligosaccharides (HMO) on mucosal immunity, gut microbiota and response to rotavirus (RV) infection was investigated in the piglet model. Newborn piglets were fed with formula alone (FF) or formula supplemented with 4 g l(-1) HMO (HMO) or a prebiotic mixture of 9:1 short-chain galactooligosaccharides (3.6 g l(-1)) and long-chain fructooligosaccharides (0.4 g l(-1)) (PRE) (n=19-21 per group) for 15 days. Piglets (n=7-8) in each dietary group were orally infected with porcine rotavirus (RV) OSU strain on d10, and stool consistency was assessed daily. Blood, small intestine and colonic contents were collected at day 15. Serum RV-specific antibody concentrations, intestinal histomorphology, RV non-structural protein-4 (NSP4) and cytokine mRNA expression were assessed. Colonic content pH, dry matter (DM) and short-chain fatty acid concentrations were measured. Ascending colonic microbiota was analyzed by 16S rRNA gene v1-3 region pyrosequencing. HMO- and PRE-fed groups had shorter duration of diarrhea than FF piglets. Infection changed intestinal histomorphology, increased serum RV-specific antibody response and intestinal RV NSP4 expression, and modulated ileal cytokine expression. HMO enhanced T helper type 1 (interferon-gamma) and anti-inflammatory (interleukin-10) cytokines in the ileum, while prebiotics promoted RV-specific immunoglobulin M response to the infection. RV infection and HMO supplementation altered intraluminal environment and gut microbiota. HMO increased pH and lowered DM of colonic contents and enhanced the abundance of unclassified Lachnospiraceae, which contains numerous butyrate-producing bacteria. In conclusion, HMO and prebiotics did not prevent the onset of RV infection but reduced the duration of RV-induced diarrhea in piglets, in part, by modulating colonic microbiota and immune response to RV infection.