A thermal flow sensor includes a heater temperature controller that realizes stable startup characteristics and prevents degradation of a sensor element and can also accommodate a smaller heater. The sensor also includes a semiconductor substrate; a cavity portion provided in the semiconductor substrate; a dielectric film provided on the semiconductor substrate; a thin layer area formed as a result of the dielectric film covering the cavity portion; a heating resistor provided in the thin layer area on the dielectric film; a first temperature-sensitive resistor provided in the thin layer area on the dielectric film; a heating controller; a second temperature-sensitive resistor provided near the heating resistor; and a flow rate detector that detects a flow rate of a fluid on the basis of temperature of the second temperature-sensitive resistor. The heating controller controls the temperature of the heating resistor on the basis of first and second reference temperatures.