If it's random, probably a hardware issue, overheating usually. Does it shut off both on battery and wall power? Does it do it in random programs?
Quick way to see if it's a hardware issue, run a benchmark on it to stress the components a bit, PassMark should do it http://www.passmark.com/products/pt.htm
Easiest thing to test would be the RAM, swap it out for a known good stick(s)