Batch electrocoagulation experiments were carried out to evaluate the removal of sulfate and COD from petroleum refinery wastewater using three types of electrodes: aluminum, stainless steel, and iron. The effects of current density, electrode arrangement, electrolysis time, initial pH, and temperature were investigated for two wastewater samples with different concentrations of COD and sulfate. The experimental results indicated that the utilization of aluminum, as anode and cathode, was by far the most efficient arrangement in the reduction of both the contaminants. The treatment process was found to be largely affected by the current density and the initial composition of the wastewater. Although electrocoagulation was found to be most effective at 25°C and a pH of 8, the influence of these two parameters on the removal rate was not significant. The results demonstrated the technical feasibility of electrocoagulation as a possible and reliable technique for the pretreatment of heavily contaminated petroleum refinery wastewater.