Everyone posting in this thread is saying their computer is shutting down. Is that what is really happening?
I have a January 2007 24" iMac which has never had the problems described -- until about six weeks ago. But the computer is not shutting down. If I put my hand where the startup button is on the back lower left of the machine, I can feel that it is still on. I am assuming I am feeling the fan operating. What seems to me to be happening is that the computer is going to sleep and cannot be awakened. I have found no pattern up until the last several days, as the problem has continually gotten worse. I, too, brought the machine to an Apple Store, but they could only run the "light" diagnostic tests on it because it is over seven years old. (By the way, talking to Geniuses these days is like talking to Best Buy sales clerks. Didn't used to be that way. If I ever did what one of the Geniuses told me to do, I would have screwed my system up really badly.) Their suspicion was a software problem. So I did and erase & install. I then reinstalled only my really necessary software. Made no difference at all.
I used to leave my machine on all the time. After a while with this problem, I started shutting it off at night. I now have to start and restart it several times in the morning before it will stay on. (But of course I never know when it will "go to sleep" again.) And when it happens throughout the day, I sometimes have to retsart it several times. Sometimes when the problem occurs after a restart, the machine will actually restart again by itself.
It is beyond my comprehension that a problem this serious that has been going on for this long cannot be identified and solved by Apple. I am losing all the faith I have had in the company since my first Mac purchase in 1992.