Halos form when light from the sun or moon is refracted by ice crystals associated with thin, high-level clouds (like cirrus or cirrostratus clouds).
Image Courtesy of Carlye Calvin/University Corporation for Atmospheric Research