I wanted to weigh in on this thread because it seems like many people are having this problem. I have a 27 in iMac (2009) that ran well until 2015 when the screen started going blank out of nowhere. As others have described, the computer was still running, just the monitor was black. I research and tried everything described above and finally took it to an Apple licensed independent tech. He found a problem with the hard drive. We tuned up the RAM and with the new hard drive things ran fine. He also installed the SMC fan program.
I thought I was out of the woods until a few months after it came back from the shop, the dreaded black screen started again. I found this thread, ran all the diagnostics and restarts, PRAM, etc. I double-checked the fan settings and could not stop it from happening. Thought about tossing it across the room but it's pretty heavy.
Finally, after CTRL-OPTION-EJECT'ing every few minutes, in desperation -- I lowered the brightness (again, a tip from this thread) down to 3 and it has not went to that black screen since. This is a really crappy fix -- having such a dim monitor, but at least I can use it now. I will continue to research and see if I can find a permanent solution. I did want to thank everyone who posted -- good luck everyone!