Gyroscope in iPhone 4S doesn't work
Problems with the acceleration input can be faulty software (and usually it's some process going out of control and taking time away from the other tasks - not that it calculates up incorrectly), so that was a good first step to avoid telling you to seek hardware service.

At this point, unless you think the restore process was bad, it's almost entirely probable that the hardware is at fault and you'll need to take it in for repair.