There are a few Canada threads about going downtown with 6-7h.
4h is tight in my opinion. Without Nexus or perhaps with a US passport you want to leave at least 90 mins to clear US immigration and security in my opinion. UPX takes 25 mins and sometimes only runs every 20-30 mins. Car from YYZ to downtown is about $50 and if you hit 401 traffic can take over an hour. It’s taken me 45 mins on the Kipling rocket bus before.
Too risky for too little reward imo. And if you have checked bags, even worse.
And lets not forget, 4h assumes you land on a domestic flight and on time. If your clearing customs and add in AC OTP 4h may rapidly become 3.
I would also note that myself and others here are quite familiar with YYZ and the transit options. If you are not native to the area Union station and the UPX can be quite a maze.