This is certainly odd...
A little bit more information might be helpful. When you say "shuts off", do you mean you have to power it back on via holding the power button for a few seconds and it does a full boot? What kind of pocket; a front or back pocket that is tight, or a loose pocket like a jacket? Does it happen in any pocket regardless of clothes or fabric?
I'm stretching here but the only two explanations I can think of are flexing (tight pockets) or some kind of static. Also, regarding your battery, don't assume it's alright just because you changed it. Run a diagnostic with a battery utility, such as coconutBattery (for Mac) or 3uTools (for Windows). It will tell you what the health of the battery is. Anything less than 70% of design capacity will require replacement.
Get back to the forum with more details...
crwdns2934105:0crwdne2934105:0
crwdns2934113:0crwdne2934113:0
crwdns2915270:0crwdne2915270:0
crwdns2889612:0crwdne2889612:0
1
crwdns2947414:01crwdne2947414:0
hi memo open and check battery connector
How to replace your iPhone 5 battery
crwdns2934271:0crwdnd2934271:0 lapo crwdne2934271:0