In this study, conversion of treating sludge from the wastewater treatment facility of a petrochemical plant to liquid hydrocarbons under near-critical and supercritical conditions was investigated by using water and toluene as solvent. Near- and supercritical water extraction (SCWE) of sewage sludge was studied at temperatures of 350-450 degrees C and pressures of 21.5-30 MPa. Near- and supercritical toluene extraction (SCTE) of sewage sludge was studied at temperatures of 300-450 degrees C and pressures of 8.5-20 MPa. The studies were performed with different solvent/sludge ratios (3, 1.5, and 1) for 1 h, and the optimum solvent/sludge ratio was found to be 1; it was also the value at which the highest total product yield was obtained. The results revealed that total product yield increased with increasing temperature. The yields of liquids, noncondensable gases, and residue were determined for each extraction run. The liquid yields for SCWE and SCTE were found in the range of 42.0-44.4 and 44.9-28.5 wt %, respectively. The gas yields for SCWE and SCTE were found in the range of 15.3-20.4 and 8.9-30.2 wt %, respectively. Gas products consisted mainly of hydrogen, carbon dioxide, methane, and C2-C4 compounds.