In this work we propose a stochastic model for a sequencing-batch reactor (SBR) and for a chemostat. Both models are described by systems of Stochastic Differential Equations (SDEs), which are obtained as limits of suitable Markov Processes characterizing the microscopic behavior. We study the existence of solutions of the obtained equations as well as some properties, among which the possible extinction of the biomass is the most remarkable feature. The implications of this behavior are illustrated in the problem consisting in maximizing the probability of reaching a desired depollution level prior to biomass extinction.