Real textile industry wastewater was treated with the activated sludge process, and biodiesel was produced from activated sludge which was used for the treatment of wastewater. The sequential Batch Reactor was operated at the laboratory scale under ambient conditions that were 25oC. During the treatment, some of the sludge returned to the reactor while the remaining part was harvested and stored at +4°C. To determine the optimum hydraulic residence time in the treatment of textile industry wastewater with the activated sludge process, different hydraulic retention times of 1,2,3,4, and 5 days were compared. In the study, the SBR reactor was operated with and without UV to evaluate the effect of UV on treatment efficiency. While the highest removal efficiency in real textile industry wastewater by activated sludge at HRT-3 was 62% COD and 20% color with UV, the highest removal efficiency was 43% COD and 11% color used without UV. Bio-oil was extracted by Bling and Dyer extraction method from harvested sludge. 82 ml biodiesel and 15 ml glycerine were obtained from 1 L wet activated sludge by the transesterification method.