If your computer keeps shutting down mid-game, overheating is a common culprit. This actually happened to me: my cooling fan gave out, and once I replaced it with a new one, the problem disappeared.
Games push your hardware hard, so if the fans can't keep things cool, the system will shut itself off to prevent damage. Check that all your fans are running and that vents aren't clogged with dust.