Abstract Long-term use of opioids such as morphine has negative side effects, such as morphine analgesic tolerance and morphine-induced hyperalgesia (MIH). These side effects limit the clinical use and analgesic efficacy of morphine. Elucidation of the mechanisms and identification of feasible and effective methods or treatment targets to solve this clinical phenomenon are important. Here, we discovered that YTHDF1 and TNF receptor-associated factor 6 (TRAF6) are crucial for morphine analgesic tolerance and MIH. The m6A reader YTHDF1 positively regulated the translation of TRAF6 mRNA, and chronic morphine treatments enhanced the m6A modification of TRAF6 mRNA. TRAF6 protein expression was drastically reduced by YTHDF1 knockdown, although TRAF6 mRNA levels were unaffected. By reducing inflammatory markers such as IL-1β, IL-6, TNF-α and NF-κB, targeted reduction of YTHDF1 or suppression of TRAF6 activity in ventrolateral periaqueductal gray (vlPAG) slows the development of morphine analgesic tolerance and MIH. Our findings provide new insights into the mechanism of morphine analgesic tolerance and MIH indicating that YTHDF1 regulates inflammatory factors such as IL-1β, IL-6, TNF-α and NF-κB by enhancing TRAF6 protein expression.