Heart failure is the end stage of cardiovascular disease and is a critical medical condition that poses an important therapeutic challenge for physicians owing to its high morbidity and mortality. Myocardial fibrosis is part of the remodelling process that occurs in heart failure. Many studies have shown that advanced glycation end products (AGEs) and receptor for advanced glycation end products (RAGE) are implicated in fibrosis and autophagy, but the mechanism remains unclear. In this study, we elucidated the mechanism by which the AGEs-RAGE axis mediates activation of cardiac fibroblasts (CFs) in heart failure. We used C57BL/6J wild-type (WT) mice to establish a model of heart failure by transverse aortic constriction (TAC). After 6 weeks of treatment, relevant indicators were detected. In mice subjected to TAC, AGEs were upregulated compared with sham-operated mice. Inhibition of RAGE resulted in functional cardiac protection, with reduced hypertrophy and fibrosis in mice after TAC. Of note, autophagy mediated the activation of CFs that transformed to myofibroblasts and contributed to fibrosis. In vitro, CFs were obtained from neonatal Sprague-Dawley rats and treated with AGEs, bovine serum albumin and short hairpin RNA (shRNA) for RAGE, in order to verify the results obtained in vivo. These results suggest that the AGEs-RAGE axis is involved in the pathogenesis of myocardial fibrosis in heart failure through CF activation induced by autophagy. Inhibition of the AGEs-RAGE axis attenuates cardiac dysfunction and myocardial fibrosis in mice with TAC by suppressing CF activation.