As far as I can make out they last indefinitly until destroyed. I have had sentry guns last up to 30 rounds before they were taken out.
The enemies WILL target your sentries and this also changes their pathing and stradegy.
Ive had enemies ignore myself and\or my partner and beeline for my guns attempting to knife them. (such an attack IS an instant kill on your guns and will likely be the way the enemey takes them down)
Dogs, it should be interesting to note, dont seem to properly register your sentries, and will often get 'stuck' on them, running in place until they are shot dead, or you move and the AI for the dog changes its course to run at you.
I barely use Grenade Launcher Sentries but the few times I have used them they seemed somewhat decent, if albiet extremly slow to shoot.
Normal Sentry Guns however, are golden. Brian has his opinion and he is entitled to that, but I have found that S.Guns, WITH PROPER PLACEMENT AND SUPPORT, are one of the strongest support equipments available and will more than pay for themselves in short order.
Note: IT IS EXTREMELY IMPORTANT THAT YOU EXPERIMENT WITH WHERE YOU PLACE THEM. Improper sentry placement\support will make them nothing more than an expensive waste of time. This is doubly so for juggernauts who tend to go through Sentries like a hot knife through butter. You might want to lead the juggs AWAY from your guns if possible, but the choice is yours of course.
Edit-Afterthought: I should specify that the guns work best when you support them. Left by themselves the guns will inevitably get overrun and destroyed, but when you work together with them is when they truly shine.