Myocardial infarction (MI) is a highly prevalent and lethal disease worldwide. Prevention and timely recovery are critical for the control of the recurrence and heart failure in MI survivors. The present study was designed to investigate the cardioprotective activity of the herbal medicine formula Baoyuan Decoction (BYD) and identify the active compounds and molecular targets. The ethanolic BYD extract (BYDE) was prepared by water extraction and ethanol precipitation of four herbal medicines, Astragali Radix, Ginseng Radix et Rhizoma, Cinnamomi Cortex, and Glycyrrhizae Radix et Rhizoma. Initially, BYDE was validated for the cardioprotective effectiveness in a mouse model of ischemia injury and rat cardiomyocyte H9C2 cells. As results, BYDE effectively reduced infarct size from 56% to 37% and preserved cardiac functions in mouse MI model while protected H9C2 cells against oxygen glucose deprivation. Subsequent network pharmacology analysis revealed that 122 bioactive ingredients, including flavonoids and saponins from the UPLC-MS/MS profile of BYDE, might target 37 MI-related proteins, including inflammatory and apoptotic mediators (e.g., TNF, NFKB1, CASPs, TNFRSF1A, CXCL12, BCL2A1). Pathway enrichment analysis suggested that BYDE might control the cardiac inflammation via targeting the tumor necrosis factor-alpha (TNF-α)/nuclear factor-κB (NF-κB) pathway while the selected targets were also implicated in IL-17 signaling pathway, lipid and atherosclerosis. Consequently, adenosine, ginsenoside Rh2, isoliquiritigenin, and licochalcone A were selected to generate the four-compound mixture AGILe and validated for the inhibitory effects on the TNF-α/NF-κB pathway. The results of the present study suggested that the mixture AGILe might be a potential cardioprotective remedy against MI.