Using TCAD 2D simulation, the effect of compositional grading configuration of intrinsic InyGa1−yN layer on p-GaN/InyGa1−yN/n-GaN p–i–n heterojunction solar cell has been investigated. Short-circuit current density is increased which can be ascribed to the reduction of polarization induced electric field, which is in the opposite direction of internal built in electric field. With the introduction of the intrinsic InyGa1−yN graded layer, up to indium mole fraction of 0.50, the characteristic solar cell parameters may be drastically enhanced compared to uniform profile. The proposed p–i–n solar cell has a fill factor of 87.7%, short-circuit current density of 7.64 mA cm−2, open-circuit voltage of 2.2 V and efficiency of 18.53% under AM1.5 illumination. It was observed that valance band and conduction band offsets are smoother at the interface of InyGa1−yN/n-GaN, in case of graded profiles and enhances the minority carrier collection.