This study evaluated the effects of electrocoagulation integrated in a laboratory-scale membrane bioreactor (MBR), namely EC-MBR, on the treatment performance, activated sludge morphological characterization, and membrane fouling of MBR treating actual sunflower oil refinery wastewater. The EC-MBR system exhibited significantly higher chemical oxygen demand (COD) and oil and grease (O&G) removal efficiency compared to the MBR system. Additionally, both systems achieved excellent turbidity removal, with a percentage above 99%. The membrane fouling rate was higher in the EC-MBR system compared to the MBR system. Despite the decrease in the soluble microbial product (SMP) and extracellular polymeric substance (EPS) concentration in the EC-MBR system, especially their protein fraction, the significant increase in MLSS and carbohydrates/protein ratio, and the decrease in the mixed liquor and the cake layer particles size were the main membrane fouling factors. The membrane fouling resistance distribution showed that the EC-MBR system had a higher percentage of pore blocking resistance compared to the MBR. FTIR analysis identified a greater proportion of carbohydrate compounds in the cake layer of the EC-MBR system. SEM images revealed dense microbial clusters, mainly rod- and oval-shaped bacteria, in the EC-MBR system. Furthermore, EDX analysis detected elements such as Ca, K, O, Al, and P in both systems, with the EC-MBR system showing a higher Al content. The EC-MBR system showed low energy consumption (0.431kWhm-3) and total operating costs ($0.90m-3), showcasing its effectiveness and affordability for sustainable wastewater management.