To investigate the mechanism of Hewei Anshen Formula(HWASF) in the treatment of insomnia through network pharmacology and molecular docking.Methods:The Traditional Chinese Medicine Systems Pharmacology Database and Analysis Platform(TCMSP) was used to screen the main active ingredients of HWASF and target proteins of each Chinese medicine.The insomnia targets were searched in Genecards.The HWASF-insomnia targets intersected by R language and the Venn diagram was drawn and uploaded into STRING and Cytoscape to construct the protein-protein interaction(PPI) network.The intersection targets were projected to Metascape for Gene Ontology(GO) and Eyoto Encyclopedia of Genes and Genomes(KEGG) pathway enrichment analysis.The plugin of Cytoscape was adopted to construct regulatory network.By molecular docking,visualization operations,conformational scoring and binding mode analysis were completed with protein self-ligands as the center.Results:Nineteen active ingredients and 134 Chinese medicine targets in HWASF were screened through TCMSP combined with literature.A total of 1 074 insomnia targets were obtained from GeneCards,and 49 HWASF-insomnia common targets were obtained by the Venn diagram.GO enrichment analysis found HWASF in the treatment of insomnia may be involved in a number of biological processes such as second messenger-mediated signal transduction and apoptosis,reflecting various cellular functions such as those of the overall composition of postsynaptic membrane and cell body,which include adrenergic receptor activity,neurotransmitter receptors activity and other molecular functions.The screened targets were enriched in multiple KEGG signaling pathways such as dopaminergic and serotonergic synapses,involving drug metabolism,neurotransmitter function,apoptosis,and immunity.Molecular docking indicated that HWASF treated insomnia by acting on insomnia targets such as RELA via active ingredients such as kaempferol.Conclusion:The mechanism of HWASF in the treatment of insomnia may be closely related to its multi-target,multi-component and multi-pathway regulation of core genes such as RELA,TNF,and FOS and their pathways.