A long immune-tolerant (IT) phase lasting for decades and delayed HBeAg seroconversion (HBe-SC) in patients with chronic hepatitis B (CHB) increase the risk of liver diseases. Early entry into the immune-active (IA) phase and HBe-SC confers a favorable clinical outcome with an unknown mechanism. We aimed to identify factor(s)triggering IA entry and HBe-SC in the natural history of CHB. To study the relevance of gut microbiota evolution in the risk of CHB activity, fecal samples were collected from CHB patients (n= 102) in different disease phases. A hepatitis B virus (HBV)-hydrodynamic injection (HDI) mouse model was therefore established in several mouse strains and germ-free mice, and multiplatform metabolomic and bacteriologic assays were performed. Ruminococcus gnavus was the most abundant species in CHB patients in the IT phase, whereas Akkermansia muciniphila was predominantly enriched in IA patients and associated with alanine aminotransferase flares, HBeAg loss, and early HBe-SC. HBV-HDI mouse models recapitulated this human finding. Increased cholesterol-to-bile acids (BAs) metabolism was found in IT patients because R gnavus encodes bile salt hydrolase to deconjugate primary BAs and augment BAs total pool for facilitating HBV persistence and prolonging the IT course. A muciniphila counteracted this activity through the direct removal of cholesterol. The secretome metabolites of A muciniphila, which contained small molecules structurally similar to apigenin, lovastatin, ribavirin, etc., inhibited the growth and the function of R gnavus to allow HBV elimination. R gnavus and A muciniphila play opposite roles in HBV infection. A muciniphila metabolites, which benefit the elimination of HBV, may contribute to future anti-HBV strategies.