How can I fix a Droid Razr Maxx's power button?
The power button is handled at a very low level by something like a watchdog, so if it's not working, the problem is probably in hardware, not software. That means it probably needs physically replacing. Take it to a repair shop and have them check it out.

Even if you don't think you did anything to break it, it could be the result of an earlier impact: e.g. it cracked the circuit board, but only after continued use has the crack broken the electrical circuit.