Long-term inflammation can cause chronic pain and trigger patients' anxiety by sensitizing the central nervous system. However, effective drugs with few side effects for treating chronic pain-induced anxiety are still lacking. The anxiolytic and anti-inflammatory effects of ruscogenin (RUS), an important active compound in Ophiopogon japonicus, were evaluated in a mouse model of chronic inflammatory pain and N9 cells. RUS (5, 10, or 20 mg/kg/day, i.g.) was administered once daily for 7 days after CFA injection; pain- and anxiety-like behaviors were assessed in mice. Anti-inflammatory effect of RUS (0.1, 1, 10 μM) on N9 microglia after LPS treatment was evaluated. Inflammatory markers (TNF-α, IL-1β, IL-6, CD86, IL-4, ARG-1, and CD206) were measured using qPCR. The levels of IBA1, ROS, NF-κB, TLR4, P-IKK, P-IκBα, and P65, MAPKs (ERK, JNK, and P38), NLRP3 (caspase-1, ASC, and NLRP3) were detected by Western blotting or immunofluorescence staining. The potential target of RUS was validated by molecular docking and adeno-associated virus injection. Mice in CFA group exhibited allodynia and anxiety-like behaviors. LPS induced neuroinflammation in N9 cells. Both CFA and LPS increased the levels of IBA1, ROS, and inflammatory markers. RUS (10 mg/kg invivo and 1 μM invitro) alleviated these alterations through NF-κB/MAPKs/NLRP3 signaling pathways but had no effect on pain hypersensitivity. TLR4 strongly interacted with RUS, and TLR4 overexpression abolished the effects of RUS on anxiety and neuroinflammation. RUS exerts anti-inflammatory and anxiolytic effects via TLR4-mediated NF-κB/MAPKs/NLRP3 signaling pathways, which provides a basis for the treatment of chronic pain-induced anxiety.