First you need to understand what is causing them pain, to treat pain in dogs. As dogs get older, arthritis, back discs can become a problem for them. Obviously you're not a vet, but there are still things you can do to help transition your dog into feeling better. You can do things to help them out.
Recognize pain symptoms. Sometimes it can be difficult to tell if they are in pain, since dogs don't talk to us. Usually, you should be able to know. I can tell right away when my dog isn't himself. They might tend to constantly lick a certain part of their body. They can tend to be really restless, constantly fidgeting and moving around. They look like they are in discomfort. They can become quite moody, and tend not to respond to you like they usually do. Possible refusal to eat food, or lose stool is possible as well. They'll look quite depressed and sad. They'll lack energy and movement.
Try to check where they are feeling the pain. If you notice those symptoms in your dog, try to rub your dogs back, stomach, and joints. See how they react. If they whimper, or try to get away then they are in some discomfort. No reason to panic, it's treatable what they are going through. It probably is arthritis. Dog arthritis is quite common when they get older. You can manage the pain, though.
Exercise your dog. Give them daily walks, and get them in better shape. Especially if they are over weight, and suffer from poor health. You can help eliminate pain in dogs if you can get them in better shape. Dogs need to be active, it's important.
Change your dogs diet. They might have a poor diet, and need a diet change. Before you change their food, discuss this with a vet. Changing a dogs foods is more serious than people think. There is a process involved, and it's important you follow it. Talk to your vet first.
Give them good supplements. I give my dog Virgin Coconut Oil, Omega-3, and Vitamin E. They help support healthy joints and help protect their immune system. They are anti-cancer, support a healthy heart function. They can definitely help eliminate pain. It's very effective in arthritis.
Take them to a vet. Do not give your dog any pain medications without a vet recommendation. Don't play doctor, pain medications have serious side effects for your dog. Some can be fatal, only give them medication under your vets orders. Listen exactly to what they tell you to give them. Go over any other medication your dog is on with your vet. Sometimes surgery is needed in more serious cases. You'll have to take your dog to the vet, get them checked out. Then discuss what is needed next.