1. The worst thing that you can do is shutdown or restart your Mac when it is hot. Think about it, everything is really really hot and you click shutdown or restart which stops the cooling fans. It really is best to stop all activity and let the display sleep for a while to let things cool off before shutting down.
2. When was the last time you cleaned the bottom grill work on your iMac to make sure that it is cooling properly...? I shutdown a couple of times a year and seriously vacuum out the dust build up on bottom grill on my iMac's.
3. You also might consider only sleeping your iMac 24-7, instead of shutting it down.
If you are having other problems like Kernel Panics that are forcing you to restart or black-outs from possible over-heating, then please explain in more detail what is happening.