Regional analgesia based on the local anesthetic ropivacaine plays a crucial role in postoperative pain management and recovery; however, the short duration of analgesia limits its clinical potential. Various drug delivery systems such as microparticles and lipid carriers have been used to prolong the analgesic effect, yet most of them are prone to abrupt release from the site of administration or have poor analgesic effects of less than 48 h, which fail to meet the needs of postoperative analgesia. In this study, a low-molecular-weight gelator sodium deoxycholate-based hydrogel loaded with ropivacaine (DC-ROP gel) was designed for long-acting analgesia. The noncovalent interaction between ropivacaine and sodium deoxycholate helps to improve the stability and sustained release performance of the gel. This internal drugbinding hydrogel also avoids experiencing the burst release effect commonly seen in polymer hydrogels previously reported for the slow release of local anesthetics. DC-ROP gel exhibited the dual advantages of self-healing after compression and long-term controlled release. In mice with inflammatory pain, DC-ROP gel achieved peripheral nerve block for more than 1 week after a single injection. Histological and blood biochemical analyses confirmed that the DC-ROP gel did not produce systemic toxicity, and cytotoxicity experiments demonstrated that the DC-ROP gel resulted in low irritation. These results suggest that DC-ROP gel provides a promising strategy for local anesthetics in long-term postoperative pain management, broadening the potential of bile saltbased low-molecular-weight hydrogels for drug delivery.