Metabolic inflammation is a crucial factor in the pathogenesis of obesity and promotes related complications. Accumulating evidence has indicated that regulating intestinal integrity and the gut microbiota may be new treatment strategies for metabolic inflammation and obesity. Cordycepin has been reported to improve obesity, but the mechanism is not yet clear. Here, we showed that cordycepin considerably alleviated systemic inflammation while reducing body weight gain and metabolic disorders in Western diet (WD)-fed mice. Further investigations showed that cordycepin significantly ameliorated WD-induced damage to the intestinal barrier and decreased the leakage of lipopolysaccharide (LPS) into the blood in mice by suppressing intestinal inflammation, oxidative stress damage, and decreasing intestinal epithelial cell apoptosis and pyroptosis. In addition, by using metagenomic sequencing, we found that cordycepin could also regulate the homeostasis of intestinal flora, including selectively increasing the abundance of Akkermansia muciniphila and reducing the production of fecal LPS. Besides, we demonstrated that the intestinal flora partially mediated the beneficial effects of cordycepin on improving intestinal barrier function, and obesity-related symptoms in WD-fed mice by a fecal microbiota transplantation experiment. Hence, our findings provided new insights into the role of cordycepin in improving metabolic inflammation and obesity from the perspective of regulating the intestinal barrier function and intestinal flora, and further provided data support for the utility of cordycepin in the treatment of obesity and its complications.