Nitrogen dioxide (NO2) detection with ZnO field-effect transistors is based on charge carrier trapping. Here we investigate the dynamics of charge trapping and recovery as a function of temperature by monitoring the threshold voltage shift. The threshold voltage shifts follow a stretched-exponential time dependence with thermally activated relaxation times. We find an activation energy of 0.1 eV for trapping and 1.2 eV for detrapping. The attempt-to-escape frequency and characteristic temperature have been determined as 1 Hz and 960 K for charge trapping and 10(11) Hz and 750 K for recovery, respectively. 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 sensor's temporal behavior. The model is experimentally verified and a real-time sensor has been 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 operating temperature and the duration of charging and resetting, the response time can be optimized and the sensitivity can be maximized for the desired partial NO2 pressure window.