This study proposed an optimal hybrid renewable energy system (HRES) to sustainably meet the dynamic electricity demand of a membrane bioreactor. The model-based HRES consists of solar photovoltaic panels, wind turbines, and battery banks with grid connectivity. Three scenarios, 101 sub-scenarios, and three management cases were defined to optimally design the system using a novel dual-scale optimization approach. At the system scale, the power-pinch analysis was applied to minimize both the size of components and the outsourced needed electricity (NE) from Vietnam’s electrical grid. At a local-scale, economic and environmental models were integrated, and the system was graphically optimized using a novel objective function, combined enviro-economic costs (CEECs). The results showed that the optimal CEECs were $850,710/year, $1,030,628/year, and $1,693,476/year for the management cases under good, moderate, and unhealthy air qualities, respectively. The smallest CEEC was obtained when 47% of the demand load of the membrane bioreactor was met using the HRES and the rest was supplied by the grid, resulting in 6,800,769 kg/year of CO2 emissions.