I am on my second phone. The first one I got in June 2015 and was replaced under warranty in Jan 2016 due to excessive overheating with accompanying battery drain.
The replacement has been causing problems since May. It overheats.
I am now more worried about the battery and fire etc.
The HTC One M9 is not at risk of fire or exploding.
However, one trick that has been known to work on iPhone 5 series, Droid Turbo's and others would be to completely drain the battery until you are no longer able to power the device on. Completely charge the battery using the Fast Charger, until it reaches 100% but no more than that. Drain the battery again and repeat. Rinse and repeat. After 2-3 times of this it should resolve the issue. If not, you can replace the device with a Certified Like New Replacement (CLNR) as long as there is no damage.