I have had a sprained ankle for three weeks and its still mildly swollen and causes me some pain some pain what should I do?

Have it evaluated. Many times ankle sprains, depending on grade, location and if this is an ankle that had been sprained before, can take awhile to heal. However if the symptoms linger despite conservative treatment it may not be sprained. Could be a fracture, or a tear of a ligament. You may need an x/ray or mri. See a sports doc for eval.
PT. You should get set up with physical therapy to improve peroneal muscle strength and balance sense (proprioception). See your primary care doctor or orthopaedic surgeon to get examined and a prescription for physical therapy. A compression stocking will help swelling resolution. At three weeks out you may not need any immobilization.
It may take months. Ankle/foot sprains are known to last longer than other parts of body because of their weight-bearing nature on every step you take. Mild sprain may last couple of wks, but severe ones may take months, good shoes/cushions, ankle support/aircast/braces may help. Elevate when u can. Motrin/aleve may easy pain/inflammation. If persistent/more severe, consult doc. My ankle sprain x5 months-still sore.