Yes. Text messages are stored in iPhone backups. Before switching to your iPhone 4, sync your old iPhone with your computer. Every tine you sync, a backup of your iPhone is created. To see these backups on iTunes on your computer, go to Edit > Preferences > Devices. After you plug your new iPhone 4 in to your computer to activate it in iTunes to work with your number, iTunes will allow you restore your iPhone 4 from the backup of your old iPhone.
after upgrading iPhone 3G to OS4.0 or 4.01, sms text messaging DOES NOT OPEN. unless u click reply immediately as a new sms comes in. even if u restore, same problem.
apple said the new version of 4.01 would have resolved this "known issue", but they didn't
meanwhile, apple doesnt seem to care for it's old customers, but making a working phone suddenly not work properly. and u cannot downgrade to 3.xx