Deep levels were observed using capacitance deep level optical spectroscopy ͑DLOS͒ in an AlGaN / GaN heterostructure equivalent to that of a heterojunction field effect transistor. Band gap states were assigned to either the AlGaN or GaN regions by comparing the DLOS spectra in accumulation and pinch-off modes, where the former reflects both AlGaN-and GaN-related defects, and the latter emphasizes defects residing in the GaN. A band gap state at E c − 3.85 eV was unambiguously identified with the AlGaN region, and deep levels at E c − 2.64 eV and E c − 3.30 eV were associated with the GaN layers. Both the AlGaN and GaN layers exhibited additional deep levels with large lattice relaxation. The influence of deep levels on the two-dimensional electron gas sheet charge was estimated using a lighted capacitance-voltage method.