I ended up here because I'm having the same problem. Like you said, it's not all the time - it only happens now and then.
I turn my phone completely off when I go to bed, so it's not any apps running that are the culprit. But, it is food-for-thought for those who don't turn their phone off, possibly.
It's been quite a while since it had done it and then BAM! This morning I picked up my phone and it was hot enough to semi-burn my hand.
It's just really frustrating when there's no rhyme or reason to it, and when you pick it up it's almost too hot for you to handle. There are no viable solutions so far.
I'm not going to do a hard reset on my phone unless it's absolutely a must. If that is what would fix the issue I would, but I don't think it would make one ounce of difference. This is intermittent, and the phone is off when it's happening.
I hope a solution that works comes about soon.