Most phone companies keep records of any text messages and phone calls for up to one year.
But the actual text messages are only kept for up to 5 days. So if you need a record of a text message that was sent to you then you need to keep a snapshot or other way of keeping the text message should you need it.