The natural compound Xihuang Pill (XHP) has an anti-cancer effect and was effective for breast cancer (BrCa) prevention and treatment. However, the mechanisms underlying this effect remain poorly characterized. Here, we searched the ferroptosis-related genes (FRGs) regulated by XHP using the HERB and FerrDb databases, and extracted the FRGs' data on expression and pertinent clinical data by way of the TCGA dataset. A single-factor Cox regression analysis was used to confirm FRGs associated with prognosis, and LASSO Cox regression analysis was used for prognostic model building. We then constructed a prognostic model and assessed it based on Kaplan-Meier survival curves and ROC curves. Next, we applied GO, KEGG, and ssGSEA analyses to further investigate FRGs' functions and potential mechanisms. We discovered that eight FRGs from the XHP targets were associated with a higher likelihood of survival. The prognostic model formed by eight genes also possessed good prognostic ability, and the risk score could be a separate risk factor for the BrCa prognosis. The GO, KEGG, and ssGSEA analyses showed risk score-related genes were associated with immune-related activities. Molecular docking showed that quercetin and beta-sitosterol as XHP's active ingredients are effective and promising agents for the treatment of BrCa. Our results provided insights into the underlying molecular mechanisms by which XHP improves BrCa patient prognosis; quercetin and beta-sitosterol may provide a new road for anti-BrCa natural products.