An upflow anaerobic sludge blanket (UASB) bioreactor was successfully used for the treatment of petroleum refinery effluent. Before optimization, chemical oxygen demand (COD) removal was 81% at a constant organic loading rate (OLR) of 0.4kg/m3d and a hydraulic retention time (HRT) of 48h. The rate of biogas production was 559mL/h at an HRT of 40h and an influent COD of 1000mg/L. Response surface methodology (RSM) was applied to predict the behaviors of influent COD, upflow velocity (Vup) and HRT in the bioreactor. RSM showed that the best models for COD removal and biogas production rate were the reduced quadratic and cubic models, respectively. The optimum region, identified based on two critical responses, was an influent COD of 630mg/L, a Vup of 0.27m/h, and an HRT of 21.4h. This resulted in a 76.3% COD removal efficiency and a 0.25Lbiogas/Lfeedd biogas production rate.