There’s not much you can do. It’s not because he’s misbehaving or forgot how he was trained, it’s
because he can’t help it. This is again similar to what happens in humans – as they age, their bladders become less and less effective. Lack of control is a common side effect. Believe it or not, this is possibly more stressful for him than for you.
While you have to clean up after him, he has to feel like he’s disappointing his best friend, losing control of his own body, and missing out on his usual routine all at the same time. To rule out any infections, take him to the vet when his accidents first start occurring so he can be tested for urinary tract problems.
You can help him feel better and help avoid accidents by taking him outside more frequently. If he used to go on walks three times daily, try to double that. It may seem like a big commitment, but would you rather be outside enjoying nature with your buddy or inside quietly fuming because you have to clean the carpet yet again? Oh, and you really should be quietly fuming. Incontinence is not something your pup does by choice, it’s a byproduct of the aging
process. Yelling and screaming at him will only make him feel worse, increase his stress level, and help him age faster.