No time limit. Once you are in, you are in. However, no facilities at the top. There are toilets, but they are closed due to people having sex in them. This does mean that you are there for as long as your bladder and/or bowels can hold out. The are also no refreshments up there, and I don't think they'd allow you to take a picnic. I expect that if there were more home comforts up there, it would fill up as people would not leave.
We were there for a good three hours or so.
Book in advance. The tickets on the day are £100 a head, if you can get in. Also try to get a time when you see the change from day to night. If you are lucky with the weather, you'll get a sunset. You'll see the lights come on over the city during that time.