Hello, XXXXXXXXX
Any changes in the home like people, pets, furniture, remodeling, etc?
Any problems with pooping outside the litter box?
I see thank you for the extra information.
It very well could be the neighbor cat coming and going from your house. He may have used your cat's litter box or sprayed in your house when you didn't know it and triggered this behavior from your own cat. Cats can very territorial about others cats; even cats they like and are familiar with.
You can use a litter called cat attract. Attract Litter is designed to make it easier to get cats of all ages trained or re-trained to use the litter box. You can get this a petsmart, petco, and larger pet supply stores.
Very important to clean the areas that has been marked. You need to use a enzyme odor eliminating cleaner such as nature's miracle. Regular cleaner such as Lysol will not work as good. He keeps going to the same spots because he smells his scent there. You must get rid of the scent. Nature's miracle also makes a cat only formula now. You want to wash down the floors and walls really good with this.
You can also use a product called feliway. This is a pheromone spray that helps cats with aggression, territorial issues, and anxiety. You can spray it on surfaces he has previously urinated on. You can also get it in an electric plug in that puts the pheromone into the air called Comfort Zone. You can get this at Pet Smart or most larger pet supply stores.
When you do catch him using the litter box appropriately reward him with a yummy little kitty treat. Cats learn very fast a reward method of training.
If you notice him ever straining to urinate or blood in his urine, then you need to address this as a medical problem and not a behavior problem. Cats will avoid the litter box if they develop conditions like urinary tract infections and such. If this occurs then you need to make him an appointment with the vet.
Also maybe closing the window and just feeding the neighbor cat outside will help him stop too.
Sincerely, XXXXX
Expert in cat behavior and health
Expert in cat medical and behavior issues.