We performed an experimental and theoretical study of nonresonant detection of sub-terahertz radiation in GaAs/AlGaAs and GaN/AlGaN heterostructure field effect transistors. The experiments were performed in a wide range of temperatures (8-300K) and for frequencies ranging from 100GHz to 600GHz. The photoresponse measured as a function of the gate voltage exhibited a maximum near the threshold voltage. The results were interpreted using a new theoretical model that shows that the maximum in photoresponse can be explained by the combined effect of exponential decrease of the electron density and the gate leakage current.