This does tend to happen to mobile phones, for a variety of reasons, and, usually a battery pull does the trick.

If, on the other hand, it happens often, or increases frequency in occurances, you might have a defective device, and it should be returned/replaced.