As a representative of acupuncture and nonpharmaceutical therapy, auricular acupuncture has been widely for the treatment of insomnia. Transcutaneous auricular vagus nerve stimulation (taVNS) is a combination of auricular point stimulation and vagus nerve stimulation. It can not only treat primary insomnia effectively, but also is noninvasive, painless, portable and economical. The medial prefrontal cortex (mPFC) is a core region of default mode network (DMN), which is important for maintenance of sleep. However, the mechanism of taVNS in alleviating primary insomnia (PI) remains to be clarified. In this study, we found that taVNS could not only effectively reduce the score of Pittsburgh Sleep Quality Index, but also decreased functional connection (FC) between the left mPFC and bilateral dorsal anterior cingulate gyrus as well as FC between the right mPFC and the occipital cortex in patients with PI. Furthermore, the decrease in FC was positively correlated with the decline of sleep index score. Therefore, we proposed that treatment with taVNS can improve sleep quality and prolong sleep duration in patients with PI by reducing FC within DMN, FC between DMN and salience network, as well as FC between DMN and the occipital cortex. This may be one of mechanisms of taVNS in treating PI.