The sensors in your mobile device are integral for gaming (try to beat my Temple Run 2 score), as well as many of the basic Galaxy S3 features like Smart Stay and other fancy additions. But sometimes those sensors can become overly sensitive or just downright unusable.
Unless you're a Samsung technician, a faulty sensor could be a difficult issue to remedy. But luckily, most of the orientation issues are due to faulty software and not hardware. There are a bunch of free sensor checking apps in the Play Store, so make sure to check one of them out to see if your sensor really is buggy.
The easiest way to troubleshoot sensor issues is by Factory data Resetting your device. This will undo any of the conscious or unconscious changes you might have made to your Android system that could've caused your sensor to become unreliable. Just go to Settings -> Personal -> Back Up and Reset -> Factory Data Reset -> Reset Device -> Delete All.
You can also Factory Reset or "hard reset" in recovery mode. This is a more drastic move, compared to the Factory Data Reset as it erases everything, and restores your device to its most recent firmware. Again, make sure to back up your data beforehand. And you can also remove your SD card if you don't want to risk wiping anything unwarranted.
Power off your Galaxy S3. Next, hold the Power, Home and Volume Up Button simultaneously. Once you see the Samsung logo you can release the buttons. Then use the volume buttons to select wipe data/factory reset. Press the power button to select and then reset your device.