Recently I've been trying to find a way to save my iMessages history from my iPhone 5s to computer. I'm aware that Apple saves text messages and iMessages in it's iPhone backup, but unfortunately I am not much familiar with SQLite databases.
Finally the app/program mentioned here helped me transfer all my iMessages and texts to my computer: http://www.easyphonerecovery.com/how-to-backup-save-iphone-text-messages-to-pc-or-mac.html
This software can transfer iMessages to a computer as a Text and HTML file with all the useful meta information, including date, time, and who said what. In trial mode it lets you transfer 20 messages from each contact. You need to pay if you want to export a really large number of text messages/imessages.