IPhone 4s freezing up

My iPhone 4S keeps freezing up. Why is the happening? It will just randomly freeze up and my lock button or home button won't work… And then it will just stop, unfreeze, and go to the home screen. I don't have iOS 7. And it's mainly when I'm texting or use the app for it.

The first way is if only one app is frozen and you can fix that by forcing that app to close. To do this hold, hold down the Power button until the "Slide to Power Off" bar appears. Instead of turning the slider to off, release the Power button and hold the Home button down. This will force the app that is frozen to close and your iPhone should then be begin to work properly again.

If forcing an app doesn't help unfreeze your iPhone, then the next best step is to force your iPhone to reboot. That is easy to do by holding down the Hold and Home buttons at the same time until you see the Apple Logo appear. In extremely rare cases, this method still won't work. If that is the case for you, then you will need to restore your iPhone.