I bought an iPhone 4s last month (AT&T) and it was working fine up until I installed iOS 5.1. About a week after that, I started getting the SIM failure about every hour or so. Turning off the phone for a while or removing it from my spec case seemed to help, but did not resolve the issue. Anybody else notice the phone runs hot when you are making calls, and that he SIM failure happens more often during calls? I really think this is a firmware or software problem. I tried some of the suggestions on this thread (except for anything to do with removing the SIM because I am a weenie about things like that), but it actually seemed to get worse (failing about every fifteen minutes). The iPhone was also acting flaky - randomly freezing, the volume bar disappeared, my text chime would not play the tone although the call ringtone would sound,etc.
Somehow, I managed to get it to stop and it has now been working fine for several days, no failures! I did three different things and I'm not sure which fixed it so I will list everything I did. Perhaps this will help somebody else.
1) I backed up the phone via iTunes and did a Restore from iTunes. After the phone rebooted, still had the SIM issue after about a minute.
2) Found a posting about making sure the SIM lock was not on. Now mine was not locked to start with, but my brain sometimes makes odd leaps. While looking at my general settings, I noticed my auto-lock. On a whim, I set it to Never. The phone froze.
3) Did a hard reset of the phone (on button/home button). The phone has worked fine since.
I have to remember to lock the phone since I have the auto-lock off, but I am not changing it back. It seems a small inconvenience to pay in order to have my iPhone back and functioning again. Because of what I did to get it working, I think Apple has a firmware or software bug. Hopefully there will be a fix for this in 5.2. Being a software developer myself, I find it highly disturbing that they are maintaining a wall of silence about this. Judging from web chatter, this is a pretty widespread problem. Didn't they learn anything from the iPhone 4 debacle? Apple quality has dropped considerably. I recently had a hard drive fail on a year old iMac. If I wanted pc quality, I'd buy a pc. I expect more from you, Apple. Steve would be ashamed.