Pirfenidone (PFd) is an anti-fibrotic agent that is clinically used in the treatment of idiopathic pulmonary fibrosis. PFd has been shown to exert protective effects against damage to orbital fibroblasts, endothelial cells, liver cells and renal proximal tubular cells; however, its effect on myocardial cell apoptosis remains unclear. The present study aimed to characterize the effects of PFd on homocysteine (Hcy)-induced cardiomyocyte apoptosis and investigated the underlying mechanisms. H9c2 rat cardiomyocytes were pre-treated with PFd for 30 min followed by Hcy exposure for 24 h. The effects of PFd on cell cytotoxicity were evaluated by ccK-8 assay. The apoptosis rate of each group was determined by flow cytometry. The protein and mRNA levels of connexin 43 (cx43), Bax, B-cell lymphoma-2 (Bcl-2) and caspase-3 were measured by western blot analysis and reverse transcription-quantitative PcR, respectively. The present results demonstrated that the apoptotic rate increased following Hcy exposure, whereas the apoptotic rate significantly decreased following PFd pre-treatment. Furthermore, the ratio of Bax/Bcl2 was upregulated following Hcy exposure, and Hcy upregulated the expression levels of cleaved caspase-3 and cx43. Notably, these effects were prevented by PFd. Additionally, the effects of PFd were inhibited by the Cx43 agonist, AAP10. In summary, the findings of the present study demonstrate that PFd protects H9c2 rat cardiomyocytes against Hcy-induced apoptosis by modulating the cx43 signaling pathway.