My power keeps going out but when it does so does my iPhone why is this happening?

I live in Raleigh NC and lately it's been really hot I mean we've broken temperature records like everyday. I already knew that heat could cause power outages but yesterday I was on my phone and the power went out but so did my cell phone. The power came back on a few seconds later so in turn so did my phone. I didn't think much of it but then it happened again like an hour ago. I didn't have my phone plugged in so it wasn't a power surge could it be the the kind of phone I have, I have an iPhone 5s. I'm just really curious to why this keeps happening so if you know please lay some knowledge on me.

Because mobile phone networks go out when the power goes out

But how does that turn my phone off.

Could be a glich in the software maby some cell tower lost power and your phone could not understand what is going on so it crashes.