It may be time for a new battery. I'd try that first since what's next is a new mainboard.
my lg g4 suddenly started having this problem 3 days ago without any apparent issue. it turned off by itself and stayed so for many hours. i tried turning it on, but in vain. then after a few hours it turned on by itself. Now i am constantly having this issue. it turns off, and some times stays off for just five minutes and then turns back on, but sometimes it even dies for like hours. also the very first time it did so it became very hot, the battrry was some 80% but dropped to 20, now its charging very slow. i havent installed any new app, and i didnt dropped my phone either. it is a at&t version, working in another country on another network.