It sounds like you dog has hip dysplasia. I have a dog that was diagnosed three years ago, and he needs both hips replaced. He also had a knee replaced. The vet told us that there was a chance if the hips were replaced they might not work, and the cost would be $5000.00 per hip.
The vet advised us to give him 1500mg of glucosomine every day and 1 coated asprin for pain. We crush the pills in his food every day. The vet estimated his hips would last two years, it has been three years and he is still doing well. You can get the glucosomine from the store and it does not have to be made for pets, you can use the brand for humans. We also bring him inside in the winter and try not to let him lay on concrete.
I understand your pain, but all we can do is take care of them the best that we can.
Terri