GaN-based p–i–n ultraviolet photodetectors (UV-PDs) with a 20 nm thick Al2O3 passivation layer are fabricated and the photocurrent generation mechanisms of the device at different biases are studied by performing different electro-optical measurements. Our UV-PDs reveal good rectifying current–voltage behavior but their generated photocurrent to UV light varies sub-linearly with the impinging power. This sub-linear trend is ascribed to the effect of strong carrier trapping. Furthermore, in reverse bias mode, PDs show higher photocurrent than forward bias, suggesting the higher charge carrier separation process caused by the exacerbated electric field. The simulated results are also agreed well with the experimental observations.