Macbook Pro goes to sleep randomly during use
I have an early 2011 Macbook pro that now randomly goes to sleep during use. Happens roughly once or twice a week. Can't recall the exact date of start, but it has been happening for a couple months I think. Could be since the installation of Yosemite but again, not entirely sure. To turn it back on I have to close the screen and re-open it, pressing keys etc doesn't work. It's not difficult but it is a pain when it just shuts off.
Any help would be appreciated!
MacBook Pro (15-inch Early 2011), OS X Mountain Lion (10.8.2)