Struggling to sleep in a flare

Hi I am RA in my hands, wrists, hips and potentially shoulders. The shoulders, hands and wrists are all new and have been flaring for over 3 months straight now. For the last few weeks I have been barely sleeping and I am always waking up at 7am in a lot of pain and a lot of morning stiffness. How do you guys cope with the lack of sleep, I am a university student and have to work, the lack of sleep is starting to get to me mentally and no matter what I have only been getting between 4-6 hours of sleep a night, it’s really starting to get to me. How do you guys manage it in a bad flare. Many thanks