Azo dyes like methyl orange (MO) are very toxic components due to their recalcitrant properties which makes their removal from wastewater of textile industries a significant issue. The present study aimed to study their removal by utilizing aluminum and Ni foam (NiF) as anodes besides Fe foam electrodes as cathodes in an electrocoagulation (EC) system. Primary experiments were conducted using two Al anodes, two NiF anodes, or Al-NiF anodes to predict their advantages and drawbacks. It was concluded that the Al-NiF anodes were very effective in removing MO dye without long time of treatment or Ni leaching at in the case of adopting the Al-Al or NiF-NiF anodes, respectively. The structure and surface morphology of the NiF electrode were investigated by energy dispersive X-ray (EDX), and field emission scanning electron microscopy (FESEM). Response surface methodology was utilized to predict the optimum conditions by considering current density with 4–8 mA/cm2 range, NaCl concentration in the range of 0.5–1 g/L, and electrolysis time of 10–30 min as controlling parameters. A very high MO dye removal percentage was achieved (97.74%) at 8 mA/cm2, 1 g/L of NaCl within 30 min of electrolysis and consumed energy was 36.299 kWh/kg. This cost-effective EC system with the Al-NiF anodes besides Fe foam as cathode approved its high efficiency in removing MO dye with moderate amounts of NaCl due to the excellent 3D structure of these foam electrodes which highlight foam electrodes as an excellent choice for EC system in an environmentally friendly pathway.