MacBook Pro goes black for a second or two and then comes back on My MacBook Pro (mid 2012) 15″ goes black for a second or two while I'm using it and then comes back on as soon as I touch the trackpad, or sometimes it comes back on its own. It's very sporadic. Why is this happening and how can I prevent it?
That actually sounds like an intermittent connection caused by a broken wire/conductor, or a bad solder joint. Essentially, you have two ends of a conductor that should be joined, but mild vibration is causing them to make/break contact, causing the symptoms you describe.

However, you should confirm that your screen saver settings aren't set to turn on after a very short duration.


System Preferences >> Desktop &amp; Screen Saver >> Screen Saver tab.
At the bottom-left, try setting Start after = Never


BTW, if you want easy method to manually enable the screen saver, click Hot Corners and set a corner for Start Screen Saver.

It would be good news if just the screen saver is causing the blank screen.

Otherwise, you should send the macbook in for repairs (when you have a break from needing it).