Nitrogen dioxide (NO2) detection with ZnO field-effect transistors is based on changes in the threshold voltage caused by charge carriertrapping. Here we investigate the dynamics of charge trapping and recovery as a function of temperature. The threshold voltage shifts for both trapping and recovery follow a stretched-exponential time dependence with thermally activated relaxation times. We find an activation energy of 0.1 eV and 1.2 eV for trapping and detrapping, respectively. The attempt-to-escape frequency and characteristic temperature have been determined as 1 Hz and 960 K for charge trapping and 1011 Hz and 750 K for recovery. Thermally stimulated current measurements confirm the presence of trapped charge carriers with a trap depth of around 1 eV. The obtained functional dependence is used as input for an analytical model that predicts the sensors temporal behaviour. The model is experimentally verified and a real-time sensor hasbeen developed. The perfect agreement between predicted and measured sensor response validates the methodology developed. The analytical description can be used to optimize the driving protocol. By adjusting the duration of charging and resetting and the operating temperature, the response time can be optimized and the sensitivity can bemaximized for the desired NO2 pressure window.