Before you restore, make sure to do a complete backup of your iPhone. iTunes will automatically do this when you plug in your phone. The backup process make take some time, so be patient.
After the backup is complete, click on 'Restore' and let the restoration process do its thing. Once the iPhone is done restoring, iTunes will ask you if you want to set up your iPhone as a new phone, or if you want to restore your iPhone from a backup. If you choose to restore from a backup, you WILL NOT loose any contacts, text messages, recent calls, settings, etc. on your iPhone. Everything will be restored to the way it was.