Oilfield produced water is one of the vast amounts of wastewater that pollute the environment and cause serious problems. In this study, the produced water was treated in a microbial fuel cell (MFC), and response surface methodology and central composite design (RSM/CCD) were used as powerful tools to optimize the process. The results of two separate parameters of sulfonated poly ether ether ketone (SPEEK) as well as nanocomposite composition (CNT/Pt) on the chemical oxygen demand (COD) removal and power generation were discussed. The nanocomposite was analyzed using XRD, SEM, and TEM. Moreover, the degree of sulfonation (DS) was measured by NMR. A quadratic model was utilized to forecast the removal of COD and power generation under distinct circumstances. To obtain the maximum COD removal along with maximum power generation, favorable conditions were achieved by statistical and mathematical techniques. The findings proved that MFC could remove 92% of COD and generate 545 mW/m2 of power density at optimum conditions of DS=80; and CNT/Pt of 14 wt% CNT- 86 wt% Pt.