1. "That's probably a hardware issue" In response to In response to 0
Back it up, take that to Apple and swap it out.
If you think it's not hardware then back it up, completely wipe it and don't restore from backup and see if it happens still.
If it does - it's a hardware issue.
Other issues it could be is the display dims when the phone is hot - so playing a game in 90 degree weather can cause this too - or bad batteries or bad sensors/etc. All hardware.