Using temperature-dependent photoluminescence (PL), we report a detailed study on the optical transitions in AlyInxGa1−x−yN (0.01≤ × ≤ 0.023, 0.07 ≤ y ≤ 0.14) of variable thickness (20 – 100 nm) grown on GaN by metalorganic chemical vapor deposition (MOCVD). At 100 K, highest electron mobility has been obtained for samples with 40 nm thick AlInGaN epilayer and this is due to the contribution from the two-dimensional electron gas (2DEG) in the confined two dimensional potential well. In literature, such 2DEG phenomenon is not discussed for AlInGaN quaternary alloys. In our samples, we have clearly observed such effects from low-temperature PL spectroscopy for AlInGaN epilayer of thickness ≥ 40 nm. The PL peaks observed due to the interband transitions from 2DEG sub-bands to the valence band are in the range 3.55 – 3.68 eV for the sample with an epilayer thickness of 100 nm. Due to the composition pulling effect in this alloy, there is a higher incorporation of Al towards the surface for thicker AlInGaN epilayer, which generates a stronger piezoelectric field and a deeper triangular potential for electron confinement. This is evident from the observation of higher intensity ratio for 2DEG transition compared to band-edge transitions, I2DEG/IBE in sample with thicker AlInGaN epilayer at higher temperature. The intensity ratio, I2DEG/IBE however decreases subsequently for all the samples with further increase in temperature due to thermal excitation.