Cellphone companies keep what's called text message details for up to a year but the actual text message content is only kept in the cellphones database for up to 5 days before it's erased and non recoverable.
A cellphone company will also keep your call records for up to a year in the event police need the information.