You can export your contacts as a .csv file. Open your contacts, hit menu, then Export to SD Card. You can then leave them there, or import them to the gmail account associated with your phone. That way, when setup again, the phone will download the contacts to your phone.
As for SMS etc, there are SMS backup tools on the market, but I've never used any so can't comment on how good any are.
Just to be on the safe side, I'd remove your SD Card when you do it too.