Bone loss is a severe complication of primary biliary cirrhosis (PBC). Trehalose was intermittently administered in bile duct‐ligated (BDL) male rats, a PBC‐related osteoporosis model, for 4 weeks to reduce osteoporosis. Femoral bones were assessed ex vivo by micro computed tomography (CT) and histomorphometry. The potential mechanisms related to the reduction of osteoporosis were explored by evaluating the effect of trehalose on osteoblast autophagy, osteogenesis, osteoclastogenesis, and ERK phosphorylation. The results demonstrated that trehalose reduced osteoporosis of BDL rats and decreased osteoblast‐mediated osteoclast differentiation by enhancing osteoblast autophagy to regulate osteoprotegerin (OPG) secretion. Hydroxychloroquine (HCQ) increased the expression of OPG and OPG/receptor activator genes for nuclear factor‐κB ligand (RANKL) ratio, and reduced osteoblast‐mediated osteoclastogenesis by inhibiting autophagy flux and inducing autophagosome formation. Furthermore, trehalose increased the phosphorylation of ERK1/2 in MC3T3‐E1 cells, and the ERK inhibitor PD98059 reversed the upregulation of OPG gene and reduction of trehalose‐induced osteoclastogeneis. The treatment with HCQ markedly increased the ERK phosphorylation. The correlation between autophagosome formation and ERK phosphorylation was confirmed in autophagy proteins (ATG) 4B or ATG5‐deficient cells. Thus, trehalose could decrease osteoblast‐mediated osteoclastogenesis and reduce PBC‐related bone loss by regulating ERK phosphorylation via autophagosome formation.