The safety of underground coal mining is threatened by coal spontaneous combustion, making it essential to develop effective inhibitors to prevent such incidents. To address this, a new in-situ gel has been proposed, which is formed in coal pores from a fire-prevention aqueous solution (FPAS) that reacts with atmospheric CO2. To determine the appropriate concentrations of polyvinyl alcohol (PVA) and sodium-metasilicate nonahydrate (SN) for FPAS, 24 groups of wire-mesh basket tests were conducted on Baiyinhua coal. The gelling mechanism and performance on fire inhibition of FPAS were then investigated using temperature-programmed tests, scanning electron microscopy, energy dispersive spectrometry, fourier transform infrared tests, thermogravimetric differential thermal analysis tests, and fire-extinguishing tests. The results indicate an inhibition rate of up to 43.3% and effective protection of active groups from oxidation. The in-situ gel demonstrated excellent fire-extinguishing properties. Additionally, the self-ignition temperatures of residual coals with varying thicknesses were estimated using the Frank-Kamenetskii theory. The combined method of CO2 injection and FPAS spraying is recommended for achieving better fire-prevention effectiveness in coal mine gob. The findings are expected to provide guidance on the application of FPAS to address thermal hazards in coal mines.