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 [http://www.coconut-flavour.com/coconutbattery/|coconutBattery] (for Mac) or [http://www.3u.com/|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...