How many SMS and contacts can be stored in an iPhone
As far as I remember there used to be a limit in early iPhones on early software, something around 2000? But I don't think there is a limit these days.

Text messages are stored in SQLite database which has very, very large limits of number of rows. I managed to store over 3000 messages on my iPhone 3G.