I have a dog like that. The only thing I could do to stop it is to neuter him (he was almost 4 when I did it). It took a long time for the testosterone to get out of his system but at 5 he no longer does it at home. I still have to watch him in pet good stores and the like.
Natures Miracle also makes a No More Marking cleaning solution that helps a lot. The best price I've found is on Amazon. I bought the gallon size and use it with my Rubbermaid sprayer mop and it works real well. You can out it in a spray bottle and spray anything like furniture that gets hit. It has a kind of very mild cinnamon type of scent which dissipates quickly to a human nose. It also works for puppy accidents and that kind of stuff. It seems expensive but I've been working off the first gallon for over a year and not having those little gifts is worth the cost.