Xiaotan Sanjie Formula (XTSJF), a traditional Chinese prescription, holds promising potential in addressing gastric cancer (GC). Despite this, the fundamental constituents and underlying mechanisms that define XTSJF’s attributes remain enigmatic. Against this backdrop, this study endeavors to unravel the latent mechanisms driving XTSJF’s impact on GC, leveraging the synergistic prowess of network pharmacology and molecular docking methodologies. To understand the potential mechanism of XTSJF against GC, this study used network pharmacology, molecular docking, and bioinformatics analytic methodologies. There are 135 active components where the active ingredients with a higher degree value are quercetin, β-sitosterol, naringenin, nobiletin, and kaempferol and 167 intersecting targets in which TP53, MAPK3, MAPK1, STAT3, and AKT1 were key targets were identified in XTSJF in the treatment of GC. According to GO and KEGG analyses, XTSJF is mostly involved in the positive control of transcription from the RNA polymerase II promoter, enzyme interaction, and other biological processes in GC. KEGG analysis shows that XTSJF treated GC primarily by regulating signaling pathways including the TNF, PI3K-Akt, and MAPK signaling pathways. According to the results of the PPI network and molecular docking, quercetin, β-sitosterol, naringenin, nobiletin, and kaempferol exhibit stronger affinity with TP53, MAPK3, MAPK1, STAT3, and AKT1. This study indicates the active components of XTSJF as well as its possible molecular mechanism against GC, and it serves as a foundation for future fundamental research.