Just thought I'd share my experiences here. Got my iPad 2 in August. Since then it intermittently goes to sleep when moved just as you've described. This can be whilst using an App or whilst on the home screen. I contacted apple support and had a half hour session on the phone. This involved resetting the iPad by doing the following:
They added a new user account onto my MacBook, then installed iTunes and then plugged the iPad in whilst pressing the button and and reset it from iTunes.
It didn't work, so I got back in touch and insisted on a replacement which was sorted out for me. I was told not to set up the new iPad from an iTunes back up in case there was a software corruption issue. On receiving the new iPad I set it up from an iCloud back up. The symptoms continued. I have since reset the iPad from the settings menu and also erased the contents to start afresh. I set it up as new not using any back up and the symptoms are still there. I've just tried pressing the menu button and the sleep button to reset the iPad. Downloaded some of my apps and the same thing happens.
If anyone ever comes up with a solution I'd be extremely grateful.