Apple - iPhone 5s 16GB iOS11 randomly restarts
Your issue could be one of two things: the battery or an issue with your OS.
You said you have already had your battery tested, but battery apps aren't very accurate and different tests at the Apple store will show different results.
Start by calling (or chatting with) Apple support. Do this on a different device. Ask if they can remotely run a Mobile Resource Inspector test. This will test many different components in your phone and is how they diagnosed my battery issue.
If they determine it is not a battery issue, do a FULL restore. You'll need a computer with iTunes for this.
As always, make sure all of your data is saved. You will not restore from a backup, so save it another way.
Start by putting your phone in recovery mode.
- Shut down your iPhone.
- Press and hold both the Home and Top buttons until the connect to iTunes screen appears.
- Connect to iTunes.
iTunes will show a popup asking if you'd like to restore or update. You'd like to Restore.
Your computer will download a completely new copy of iOS 11 - that's what makes this different than doing this on an iPhone.
If your computer takes longer than 15 minutes to download the update, you'll need to put your phone in recovery mode again. Press and hold the Home and Top buttons at the same time to do this.
Warning: Restoring your phone this way will require your Apple ID password unless you didn't have Find My iPhone enabled. If you do not remember your Apple ID password, you should reset it at iforgot.apple.com
If none of this fixed your phone, I'd recommend talking to Apple Support about your issue over the phone. (Over-the-phone support is generally faster than live chat)
My recommendation is to contact Apple Support by phone and inform them of the issues you're having. Describe to them the process you went through of backing up, erasing, and restoring multiple times. Inform them of the Apple Store full diagnostic that said the hardware was functional.
Like you said, doing a full software reset (without restore) should have eliminated all software issues. This means that there could be a possible hardware issue with your phone that isn't being detected by their systems yet, similar to the recent issue with iPhone 6s batteries.
If this ends up being the case, they may send you a replacement phone at no charge.
It is most likely your battery causing this issue. Your battery capacity deteriorates over time. You might want to consider replacing your battery. It will resolve this issue, speed your iPhone, and prolong its life. It is very common to have this issue with iPhone 5s.