We use apertureless scanning near-field optical microscopy to study the phase separation in chemical beam epitaxy grown AlGaNAs alloys. Pits attributed to nitrogen-clustering observed on the AlGaNAs surface grown at 420 °C become larger at higher growth temperatures, and 3D islands appear on the surface at 565 °C. Atomic force microscopy phase measurements reveal a composition difference between the islands and the pits, whereas the sample grown at 420 °C appears to be homogeneous. Confocal Raman spectra show that all the N atoms are bonded to Al instead of Ga. Using apertureless scanning near-field optical microscopy, the luminescence of a gold tip is mapped over the surface of the sample grown at 565 °C. We extract the shift of the tip's surface plasmon resonance and determine the variation in the refractive index between the islands and the pits to be close to 0.2. Numerical simulations of the tip luminescence while in contact with the sample predict a similar variation of ∼0.3 in the refractive indices between AlGaAs islands and AlN pits, a substantially smaller value than the difference in the bulk refractive indices of the two media (∼1.8), which we attribute to a convolution of material distribution in an uneven topography. The excellent agreement between simulation and experiments supports the hypothesis of nitrogen-clustering in the pits.