Autonomic imbalance and metabolic inflammation are important pathological processes in diabetic cardiomyopathy. Gut microbiota dysbiosis and increased levels of bacterial component lipopolysaccharide (LPS) are associated with diabetic myocardial injury, but the mechanism by which gut microbes affect metabolic inflammation and cardiac injury remains unclear. We determined whether pyridostigmine (PYR), which inhibits cholinesterase to improve vagal activity, could regulate the disordered gut microbiota and attenuate gut barrier dysfunction, metabolic endotoxemia, and inflammation in diabetes. Db/db mice exhibited high blood glucose levels, insulin resistance, low vagal activity, and diabetic myocardial injury. Db/db mice also exhibited gut microbiota perturbations and subsequent disruption of gut barrier function, resulting in an influx of LPS, metabolic endotoxemia, and inflammation. PYR ameliorated the dysregulated glucose and lipid metabolism, modulated the overall structure of the gut microbiota, selectively enhanced the abundance of anti-inflammatory bacteria, and reduced the abundance of proinflammatory and potentially pathogenic bacteria in db/db mice. Importantly, PYR enhanced vagal activity, restored gut microbiota homeostasis, and alleviated gut barrier dysfunction. Therefore, the LPS-induced extracellular signal-regulated kinase (ERK)/early growth response-1 (Egr-1) pathway and consequent metabolic inflammation were inhibited, and eventually, cardiac hypertrophy, fibrosis, oxidative stress, and dysfunction were ameliorated in db/db mice. In vitro cardiomyocyte injury was induced by exposing primary neonatal rat ventricular cardiomyocytes to high glucose (HG) and LPS. In vitro analyses showed that HG + LPS induced ERK1/2 phosphorylation, Egr-1 expression, inflammation, and cell apoptosis, which were inhibited by acetylcholine (ACh). Alpha 7 nicotinic ACh receptor but not muscarinic 2 ACh receptor plays an important role in ACh-mediated anti-inflammatory effects and inhibiting the ERK/Egr-1 pathway in HG + LPS-administered neonatal rat ventricular cardiomyocytes. PYR and ACh ameliorated diabetic myocardial injury by inhibiting the LPS-induced ERK/Egr-1 pathway and metabolic inflammation. The vagus-gut-heart axis has provided new insights into the complex mechanisms of diabetes and offers novel therapeutic targets.