Have Cat Questions? Ask a Cat Vet Online.
This is usually a behavioral issue and is hard to manage. Cleaning the areas he sprays with a product made for cat marking is needed.
Next a trip to the vet...we usually put them on a medication that curbs the desire to mark. It is not meant to be long term, but a few months to break the habit. There are different options of medication out there.
Hopefully you will be able to control it before he becomes an outside cat only.