I have always had two litter trays: one in use, and one standing clean but empty. Change the tray regularly and wash it in hot water, preferably without perfumed detergent, than stand it outside to dry and air off. Cats dislike the smell of a dirty tray, as in nature they use a new place each time.
Obviously, the cat is afraid he will be deserted if he goes out. Taking him out with a harness and lead on, but carrying the cat for a very short walk in the garden, then taking him inside again might help him realise that the outdoors isn't dangerous.
Keep where he can see the door, then put the cat down and let him run home.
I can't promise it will work, but it might.
What does the cat use? The corners of the rooms? Put newspaper down and see if he will use it. If he does, put newspaper and a little cat litter in the tray.