How can I control the pain associated with swollen gums?

Treatment and rinses. The most important issue is removing the cause of the swollen gums. Sometimes the pain is so extreme the patient needs an rx from the dentist. An anti-inflammatory helps with the swelling- which is inflammation. Warm salt water rinses also help. Trying to keep the gums clean will help with the reduction in swelling and reduce the pain.
See your dentist. I recommend seeing your dentist if you continue having pain. Wishing you the best.