This study aimed to optimize the extraction of flavonoids from the stem and leaf waste of Astragalus membranaceus (AMW) using nonionic surfactant-integrated ultrasound-assisted extraction (UAE). Genapol X-080 was identified as the most effective surfactant for flavonoid extraction. UAE outperformed both stirring-assisted and heating methods in terms of yield. A sustainability analysis showed that UAE with nonionic surfactants was environmentally favorable, scoring 0.78 in the Analytical Greenness Calculator. The extraction process was optimized using Response Surface Methodology (RSM), starting with a Plackett-Burman Design (PBD) to identify important factors, such as liquid-solid ratio, ultrasonic time, temperature, ethanol concentration, and ultrasonic power. The optimized conditions were 55 min of ultrasonic time, 50 °C, 70 % ethanol, and 100 W ultrasonic power. Under these conditions, the UAE method increased flavonoid yield by 25.60 % while reducing energy consumption by 59.26 %. The optimized extracts demonstrated superior antioxidant activity in DPPH, ABTS, FRAP, and hydroxyl radical scavenging assays. These findings highlight the potential of AMW as a sustainable source of bioactive flavonoids and contribute to the valorization of plant biomass waste. Future work will investigate the underlying extraction mechanisms and explore the broader applicability of this technique for the efficient and sustainable extraction of bioactive compounds from various biomass resources.