Weather events associated with climate change can influence the environmental spread and survival of fecal pathogens, potentially impacting the efficacy of water, sanitation, and hygiene (WASH) interventions. We used longitudinal data from a randomized controlled trial in Bangladesh to assess whether rainfall and temperature modified the effect of an on-site sanitation intervention on fecal contamination. Over 3.5 years, we enumerated E. coli in household samples along eight fecal-oral pathways (n=23,238 samples) and obtained daily weather data. The intervention included the provision of double-pit latrines, child potties, and scoops for removing child and animal feces, along with behavior change promotion. The intervention was associated with larger reductions in E. coli in/on mother hands, child hands, ponds, and flies (0.10-log to 0.91-log) following higher rainfall and in/on food, mother hands, child hands, soil, and ponds (0.11-log to 0.40-log) following higher temperatures, compared to drier and colder periods. The intervention slightly reduced E. coli in stored drinking water and had no consistent effect on E. coli in tubewell water, regardless of weather. Our findings suggest that sanitation interventions can help mitigate the effects of increased rainfall and temperature on environmental fecal contamination. Previous analyses of these data without stratification by daily weather only found small (approximately 0.10-log) reductions in E. coli in/on stored drinking water and child hands. Future WASH trials should incorporate weather data to identify periods of differential intervention effectiveness to understand how weather variability influences the outcomes of public health interventions and develop strategies to enhance resilience against climate change impacts in vulnerable communities.