MacBook Pro black screens and shuts off after a few minutes' use

Solution 1:

As discussed on the MacRumors forums thread, Help! Updated to macOS 10.12.4, MBP randomly shuts off, it is likely that AppleThunderboltNHI.kext is the culprit:

So if you disable (move out of /System/Library/Extensions) AppleThunderboltNHI.kext driver then reboot. Everything runs ok, you can connect external screens via Thunderbolt.

The only drawback is that Ethernet via Thunderbolt will not work.

Solution 2:

Been having the same issue for about a year now, right now the only way to prevent it from shutting down randomly is to have the Thunderbolt Gigabit Ethernet Adapter plugged in all the time. Brought my unit to Apple multiple times but were to no avail.