Currently, nanobubbles are widely discussed in environmental research due to their unique properties, including significant specific surface area, transfer efficiency, and free radical generation. In this study, O2 and O3 nanobubbles (diameters ranging from 0 to 500 nm) were combined with conventional surfactant technology to investigate their enhanced efficacy in removing diesel contaminants from soil. The impact of various factors such as surfactant concentration, temperature, and soil aging duration on pollutant removal rates was examined across different experimental approaches (stirring/flushing). Soil samples subjected to different treatments were characterized using TG-DTG and FTIR analysis, while GC/MS was employed to assess the degradation products of diesel constituents in the soil. The results indicated that the elution efficiencies of the three surfactants (SDS, SDBS, and TX-100) for diesel in soil correlated positively with concentration (0.3–1.4 CMC) and temperature (18–60 °C), and inversely with aging time (10–300 days), with the elution capacity was SDS > SDBS > TX-100. Mechanical stirring (500 rpm) and temperature variations (18–60 °C) did not affect the stability of the nanobubbles. Upon the introduction of O3 nanobubbles to the surfactant solution, there was a consistent increase in both the removal (degraded and removed) efficiency and rate of diesel under varying experimental conditions, resulting in an enhancement of removal rates by approximately 8–15%. FTIR spectroscopy showed that surfactants containing O3 nanobubbles mitigated the impact on the primary functional groups of soil organic matter. GC/MS analyses indicated that residual pollutants were predominantly alkanes, with degradation difficulty ranking as: alkanes < alkenes < cycloalkanes < aromatic compounds. TG-DTG coupled with GC/MS analysis demonstrated that O3 nanobubbles contributed to a reduction in surfactant residues. This study significantly advances our understanding of how nanobubbles facilitate and optimize surfactant-assisted remediation of contaminated soil, thereby advancing the precise application of nanobubble technology in soil remediation.