Lipopolysaccharide (LPS) can induce bone loss by stimulating bone resorption. Natural compounds have great potential for the treatment of osteolytic bone diseases. Magnesium lithospermate B (MLB) plays an important role in protecting against oxidative damage and also has potential anti-inflammatory pharmacological properties. However, its role in LPS-induced bone loss is still unknown. In the present study, we observed the effects of MLB on LPS-induced bone damage and investigated the possible mechanisms. The bone loss models were established by LPS administration in male Sprague–Dawley rats. MLB (200 mg/kg body weight) was given by subcutaneous injection. MicroCT analysis, biomarker assay, histological examination and immunohistochemical staining were performed at the 8th weeks. In addition, RAW264.7 cells were treated with LPS in the presence or absence of MLB. The osteoclast formation, resorption activity and differentiation-related genes [(receptor activator of nuclear factor kappa-B (RANK), Traf6, Fra-1, and c-src)] expression were evaluated. LPS induced bone loss shown as the decrease in bone volume fraction and trabecular number, and increase in trabecular separation. LPS also markedly enhanced the osteoclast formation and resorption activity compared with the control. MLB significantly abolished the LPS-induced bone microstructure damage (p < 0.05) and osteoclast formation. MLB also inhibited the increases of serum tartrate-resistant acid phosphatase 5b, RANK ligand (RANKL) and TNF-α level enhanced by LPS (p < 0.05). Immunohistochemical staining indicated that MLB attenuated the high expression of RANKL and RANK stimulated by LPS. In addition, MLB significantly abolished the LPS-enhanced osteoclast formation, resorption activity, RANK, Traf6, Fra-1, and c-src expression in vitro. Our data demonstrate that MLB can suppress LPS-induced bone loss via inhibiting RANKL/RANK related osteoclast formation.