Total Petroleum Hydrocarbons (TPH) are a major environmental pollutant, posing serious risks to soil health and ecosystems. TPH contamination, often resulting from crude oil spills and industrial activities, significantly disrupts soil structure, reduces fertility, and hinders the growth of plants and soil-dwelling organisms. In the environment, TPH compounds persist due to their hydrophobic nature, leading to long-term ecological damage. They can infiltrate groundwater, compromising its purity and presenting health hazards to humans and wildlife. The existence of TPH in soil modifies the population of bacteria, reduces biodiversity, and impedes natural processes such as nutrient cycling. Effective bioremediation techniques, such as microbial degradation, are essential for mitigating the harmful impacts of TPH on soil and the broader environment. This study emphasizes the urgent need for sustainable remediation strategies to restore contaminated soils and protect ecological and human health. This study investigates the influence of environmental circumstances on bacteria employed for the remediation of soil polluted with crude oil, focusing on bacterial strains sourced from the Baiji refinery in Iraq. Microbial rehabilitation is an economical and environmentally sustainable method for decomposing hydrocarbons into simpler molecules, making it an effective method for soil bioremediation. The study monitored biodegradation over seven months, assessing the degradation efficiency of total petroleum hydrocarbons (TPH) using gas chromatography-mass spectrometry (GC-MS). Environmental factors, including temperature, moisture levels, and nutrient availability, were closely monitored to assess their impact on bacterial activity. Ideal moisture range for bacterial growth and hydrocarbon degradation is often cited as 40% to 60% of the soil's WHC. Too much water can reduce oxygen availability in the soil, inhibiting aerobic bacterial growth, while too little water can limit microbial metabolism. Temperature affects bacterial metabolism and the rate of hydrocarbon degradation. Most hydrocarbon-degrading bacteria thrive in mesophilic conditions. The ideal temperature range for TPH degradation by bacteria is generally between 25°C and 35°C. At temperatures below 15°C, microbial activity and degradation rates slow significantly, while temperatures above 40°C can inhibit bacterial growth or even kill the microbes. The results revealed that the moisture: 40%–60% of soil's water-holding capacity and temperature 25°C–35°C maintaining these conditions promotes the optimal breakdown of hydrocarbons in bioremediation efforts. The results revealed significant degradation of crude oil, with a reduction of 40 initial compounds in untreated samples to 25-35 compounds in treated samples. The biodegradation rates increased steadily over time, with a removal efficiency reaching 72.38% by the end of the experiment. Additionally, the study demonstrated that environmental conditions, particularly temperature and moisture, play a pivotal role in optimizing bacterial degradation activity. These findings underscore the potential of bacteria in bioremediation efforts and the necessity of optimal environmental conditions, such as controlled temperature, moisture content, and nutrient levels, are essential for maximizing the efficiency of crude oil degradation in contaminated soils.