MacBook randomly goes to sleep then shuts down
My 15 inch MacBook Pro has been randomly shutting down for about 2 weeks now. Even when I'm only using one application it'll randomly shut down. I have my laptop partitioned (via bootcamp) and when I run windows my laptop runs perfectly fine and never shuts down.
I've tried resetting the pram and smc multiple times. I've also been to the Apple Store twice. The first time the Genius Bar employee ran a lot of diagnostic tests and saw that nothing was wrong with the hardware (according to those tests), he then downloaded a malware app and deleted any trace of malware. Even after that it would still crash. He then told me to wipe the Mac side of my hard drive.
The first time I wiped it, I immediately restored all my data via time machine. It still crashed. The second time I wiped it, I manually dragged and dropped all the files I wanted from my external hard drive and it still crashed. The third time I wiped it, I didn't restore any old data and it would still crash.
The second time I went to the Mac store, the employee told me to wipe my entire hard drive, including the windows partition. I did it in store and my Mac seemed to be working fine. I downloaded google chrome and Spotify and ran a bunch of applications for about ten minutes and my laptop was fine. The Genius Bar employee told me if it still crashes, worst case scenario was to pay a flat fee of $575 (minus tax) and replace the logic board.
However when I got home, it crashed again. I've noticed when I use it right after wiping my hard drive and downloading another copy of Sierra it runs for about 30 minutes. After the initial shut down, it can only run for about 5 minutes.
The entire time I've been using the latest macOS Sierra. I really don't want to pay the $575 to replace the logic board. If you guys have any advice, it'll be much appreciated. Thank you guys so much!