The technology of loess solidification plays a crucial role in addressing issues such as soil erosion, with the key material in this process being the loess stabilizer. To tackle the high energy consumption problem associated with traditional loess stabilizers primarily composed of Portland cement, this study employed a more ecological sustainable alternative by incorporating solid waste coal gangue and magnesium oxysulfate (MOS) cement as a binding agent for consolidating loess. The alterations in bulk density, porosity, mineral structure, and microstructure of the consolidated soil with different MOS content were systematically investigated and validated. The pore size of MOS-solidified loess decreased significantly to a range of 0.04–3.60 μm compared to 0.80–3.88 μm for pure loess. Scanning electron microscope (SEM), energy dispersive spectrometer (EDS) and thermogravimetric (TG/DTG) analysis revealed that the addition of MOS binder generated hydrated magnesium silicate (M-S-H), Mg(OH)2, and a small amount of 5Mg(OH)2·MgSO4·7H2O phase which filled the gaps between soil particles and bonded them together effectively. When the proportion of MOS binder added reached 11 %, the compressive strength of stabilized loess after curing for 28 days increased up to 9.4 MPa. After immersion in water for 24 h, the strength only decreased by 5.3 %, with a softening coefficient of 94.7 %. The test results consistently indicate that the enhancement in mechanical properties can be attributed to the binding effect facilitated by MOS. The ecological composite binder based on coal gangue and MOS demonstrates great potential in the field of soil stabilization.