Cytochrome P450 3A4 (CYP3A4) is the main P450 enzyme for drug metabolism and drug-drug interactions (DDIs), as it is involved in the metabolic process of approximately 50% of drugs. A detailed mechanistic elucidation of DDIs mediated by CYP3A4 is commonly believed to be critical for drug optimization and rational use. Here, two typical probes, midazolam (MDZ, substrate) and testosterone (TST, allosteric effector), are used to investigate the molecular mechanism of CYP3A4-mediated heterotropic allosteric interactions, through conventional molecular dynamics (cMD) and well-tempered metadynamics (WT-MTD) simulations. Distance monitoring shows that TST can stably bind in two potential peripheral sites (Site 1 and Site 2) of CYP3A4. The binding of TST at these two sites can induce conformational changes in CYP3A4 flexible loops on the basis of conformational analysis, thereby promoting the transition of the MDZ binding mode and affecting the ratio of MDZ metabolites. According to the results of the residue interaction network, multiple allosteric communication pathways are identified that can provide vivid and applicable insights into the heterotropic allostery of TST on MDZ metabolism. Comparing the regulatory effects and the communication pathways, the allosteric effect caused by TST binding in Site 2 seems to be more pronounced than in Site 1. Our findings could provide a deeper understanding of CYP3A4-mediated heterotropic allostery at the atomic level and would be helpful for rational drug use as well as the design of new allosteric modulators.