A mathematical model of a microfluidic controller comprising a hydrogel in a typical T- and Y-junction is derived and presented. The model takes into account conservation of momentum, mass and ions for laminar incompressible flow and the deformation/sensing of a pH-sensitive hydrogel. The response of the pH-responsive hydrogel is validated with experimental equilibrium swelling curves for which good agreement is found. The model is employed to study the behavior of the hydrogel and its impact on the overall fluid flow in different microfluidic flow channel/hydrogel configurations, e.g. in a T-junction, where the hydrogel can act autonomously and without external power supply to regulate the flow. Finally, we discuss how the model can be generalized for other types of stimuli-responsive hydrogels.