Getting into the habit of regularly backing up your iPhone is a good idea -- particularly if you're concerned about losing important text messages. During the backup process, iTunes syncs all of the information on your iPhone and creates a dated backup file on your computer hard drive. This backup includes contact details, photos and every text message currently saved to your phone. In the event that you accidentally delete a message, you can easily restore your phone to a previous backup to bring back the lost message.
Open iTunes on your computer.
Connect your iPhone to your computer with a USB cord.
Right-click on your device's name in the left iTunes menu. Select "Restore From Backup" from the drop-down menu.
Select a restore point from the drop-down menu. A date is often associated with each restore point, which makes it easier for you to determine how far back you want to go. The restoration only affects your text messages, calendar entries, iPhone settings, contacts and notes. Your phone's firmware and music library remain the same.
Click the "Restore" button to begin the process of restoring your phone to a previous backup. Leave your phone plugged in until the process is complete. At this point, all previously deleted text messages from that restore point are available on your iPhone.