My iPhone 4s keeps freezing/delaying only when I text?

Everytime I have to delete a part of a word or go back in the text and correct a word it will freeze for 15-20 seconds and not let me type. It started happening a few days ago and it's starting to get really frustrating. I want to know how to fix it or what's causing it.

Hmm better you take a backup using itunes and once reset all and delete all the items in your phone and try surely this will helps you.