Nitrogen addition is commonly used to remediate total petroleum hydrocarbons (TPH) in petroleum-contaminated soils. However, acceptable exogenous nitrogen dosages and their utilization efficiency for the degradation of hydrocarbons in oil-polluted soils are not well understood. This study compared the hydrocarbon bioremediation capacity by applying different doses of NH4Cl as a stimulant in soils contaminated with TPH at 8553 and 17090 mg/kg. The results showed acceptable exogenous nitrogen levels ranging from 60 to 360 mg N/kg soil, and the optimal nitrogen dosage for TPH remediation was 136 mg N/kg in soils with different TPH concentrations. The nitrogen availability efficiency (NAE) and nitrogen polarization factor availability (NPFA) in the 136 mg N/kg addition treatments were 6.69 and 20.47 mg/mg in 8533 mg/kg TPH-polluted soil, and 6.03 and 31.11 mg/mg in 17090 mg/kg TPH-polluted soil, respectively. Metagenomic analysis revealed that the application of 136 mg/kg nitrogen facilitated ammonia oxidation and nitrite reduction to nitric oxide, and induced soil microorganisms to undergo regulatory or adaptive changes in energy supply and metabolic state, which could aid in restoring the ecological functions of petroleum-contaminated soils. These findings underscore that 136 mg/kg of nitrogen dosage application is optimal for remediation of petroleum-contaminated soils irrespective of the TPH concentrations. This exogenous nitrogen application dosage for TPH remediation aligns with the nitrogen requirements for crop growth in agriculture.