The majority of tofu manufacturers lack the necessary infrastructure to treat wastewater, resulting in the direct discharge of wastewater into water bodies. Such practices have the potential to results in environmental pollution. This study examines the efficacy of combining anaerobic biofilter technology and pre-aeration with a microbubble generator for the treatment of wastewater generated by the tofu industry. The research focused on the impact of hydraulic retention time (HRT) on the reduction of pollutants, specifically chemical oxygen demand (COD), biological oxygen demand (BOD), total suspended solids (TSS), and pH levels. The results indicated that prolonged HRT in the anaerobic biofilter significantly reduces pollutant concentrations. 48-hour HRT achieved reductions of 80.78% for COD, 78.53% for BOD, and 89.25% for TSS, respectively. The integration of a microbubble generator further enhanced treatment efficiency. The combination of a 48-hour anaerobic biofilter and a 180-minute microbubble generator achieved reductions of 93.82% for COD, 93.11% for BOD, and 97.5% for TSS. The effluent consistently met the pH quality standards set by the Indonesian government. The findings suggest the potential for optimizing retention times and combining anaerobic and aerobic treatments to address wastewater challenges in the tofu industry.