Recently, a mid-2007 MacBook was brought into us for repair because it would sporadically (and often quickly) go to sleep while in normal use. We tried the basic resets (SMC + PRAM), which didn’t do it. We ran it through our diagnostic software, which it passed (that rules out any major component malfunction). Even when booted from a known-good hard drive, the system would still exhibit the issue.
On to more troubleshooting: We swapped out the sleep switch/battery connector since that seemed to be a logical cause. Once again, the issue was still there. Next, we ordered a logic board (we reasoned that since the sleep switch connects directly to the logic board, that could affect it as well). After installation and testing, the problem still persisted.
When testing a MacBook after a part installation, we normally will not completely reassemble the computer. Instead, we put the top case back on but will not put the screws back until we are confident that the issue is fixed.
After having swapped in all these known-good parts with no luck, I booted the system for further diagnosis. It stayed awake for ten minutes straight! I was baffled. Nothing had changed since the last time I had booted it… except that the top case was now slightly more propped up than it was before.
With the MacBook on and awake, I gently pressed on the top case, right about the area where it rests over the sleep switch. It went to sleep. I tested this a few more times. The computer would instantly go to sleep when that area of the top case was pressed.
With a simple replacement of the top case, the issue was solved, and the MacBook was happily returned to its owner. The only reason we could come up with for this odd issue was that somehow that area of the top case had become magnetized and was tripping the sleep switch—just as if you had closed the lid.