I was having this issue on and off on my 2011 27inch iMac for months. It definitely seemed to be worse when it got hot.
I tried all the PRAM resets etc which did seem to trick the mac into thinking it was fine for about 10 minutes.
Turning the screen brightness down to the lowest setting and maxing out the fans would keep it going longer.
Initially I took it apart, unplugged all the screen cables and plugged them back in and it went without a problem for a few months before the issue returned during some hot weather.
As my mac is pretty old and has been in for a couple of repairs, including a new video card, plus the fact that the screen ribbon cable seemed a too easy to disconnect I decided to replace the ribbon cable. Nothing to lose as relatively cheap.
So far I’ve been running the mac for two days in full brightness with the fans set back to auto without a problem. My guess s that the cable was slightly damaged and when it was getting hot and expanding a connection was being broken.
I doubt this is the only cause/solution to this issue given the documented success of other methods on this platform and others.
If you’ve got the black screen issue and have tried all the button combi resets and done an internal ckean without success and had work done on your machine or you’ve opened it up yourself I’d give this a shot.