Mine was also doing that. Made a Genius Bar appointment where they updated the OS and (of course) the 10 minutes I was there it never restarted. But the Genius put notes in my file and said if it happens again to call Apple support about sending it in (luckily it was under warranty until Jan 2018). Got it home and within 40 minutes it restarted.
Called Apple support- they sent me a prepaid box to ship it in. They said they’d take a look and either repair or replace it. Four days later I had a replacement in hand.