The herbal pairing of Dangshen (DS) [Codonopsis pilosula (Franch.) Nannf.] and Huangqi (HQ) [Astragalus membranaceus (Fisch.) Bge.] (DHP) is a traditional Chinese herbal medicine that is frequently used to treat chronic heart failure (CHF) in China. However, the pharmacological mechanism of DHP has not been fully elucidated. This is the first study aimed to reveal the active mechanism of DHP in the treatment of CHF by using network pharmacology methods. The active ingredients of DHP were obtained from the TCMSP database, and the potential targets of DHP were predicted using the SwissTargetPrediction database. CHF-related targets were searched by the DisGeNET and GeneCards databases. The common targets between the disease and herbs were obtained using a Venn diagram. The STRING database was utilized to obtain the protein-protein interaction data. Next, we used Cytoscape 3.7.2 software to construct and analyze the herb-ingredient-potential targets-disease network. Topology analysis was used to identify the key ingredients and hub genes. Gene Ontology (GO) and Kyoto Encyclopedia of Genes and Genomes (KEGG) pathway enrichment analyses were performed using the Metascape database to reveal the mechanism. Furthermore, molecular docking simulation was performed using AutoDock Vina software to assess the affinity of the key ingredients and hub genes. Five key ingredients and six hub genes were screened. The six hub genes were closely related to PI3K /AKT or ERK1/2 pathways. The KEGG pathways mainly involved the TNF signaling pathway, calcium signaling pathway, and cancer-related pathways. The GO enrichment analysis results showed that DHP might act on biological processes including positive regulation of kinase activity and cellular response to nitrogen compound via the three above-mentioned pathways in the treatment of CHF. Finally, the molecular docking results showed that the five key ingredients exhibited strong affinities to the six hub genes. This study revealed the molecular mechanism that the flavonoids in DHP may alleviate endothelial dysfunction and cardiac hypertrophy via regulation of the TNF pathway and its downstream PI3K/Akt or ERK1/2 signaling pathways, or improve excitation-contraction coupling by regulating calcium signaling pathway, thereby improving CHF. These results provide insights for further experimentation on its pharmacological effects.