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 also showed that in the EC-MBR system, the pore blocking resistance percentage increased compared to MBR. According to FTIR analysis, the cake layer in the EC-MBR system had a higher carbohydrate compounds proportion compared to the MBR. The SEM images also reveal dense microbial clusters in the EC-MBR system, dominated by rod- and oval-shaped bacteria. EDX analysis detected Ca, K, O, Al, and P elements in both systems, with higher Al content in EC-MBR.