A unique feature of hepatitis B virus (HBV) infection in humans is that viral clearance heavily depends on the age of exposure. However, the reason for this remains unclear. Here we show that gut microbiota contribute to the age dependence of HBV immunity in a hydrodynamic transfection mouse model. Although adult (12-wk-old) C3H/HeN mice cleared HBV within 6 wk postinjection (wpi), their young (6-wk-old) counterparts remained HBV-positive at 26 wpi. Sterilization of gut microbiota from 6 to 12 wk of age using antibiotics prevented adult mice from rapidly clearing HBV. Young mice with the Toll-like-receptor (TLR) 4 mutation (C3H/HeJ) exhibited rapid HBV clearance. The results suggest that an immuno-tolerating pathway to HBV prevailed in young mice, before the establishment of gut bacteria, through a TLR4-dependent pathway and that the maturation of gut microbiota in adult mice stimulated liver immunity, resulting in rapid HBV clearance.