Would it be acceptable to set up a foldable cot at night (leave it under my desk during the day) and sleep at the lab occasionally?
A worldwide internet academic community like this one cannot answer your question directly. You need to ask the head of the lab. This is the person who will need to vouch for you if any other university member (student, employee, faculty...) finds you there at night, and this is the person who needs to feel confident that someone sleeping in the lab is neither a threat, a conflict of interest nor an embarrassment to the lab and its work.
I will go way outside my direct experience and speculate that keeping and using a cot directly inside a university laboratory is not something that the head of the lab is likely to approve. I don't know exactly what is being done in the lab, but if it's in EECS, sleeping is presumably not an intended use of the space. If you are sleeping right next to expensive and/or delicate equipment, then you are not using it as you have been trained to do, and in some (perhaps annoying but nevertheless real) legal sense you may not be qualified to remain in the presence of such equipment in a less than alert state. What if you stumble out of your cot and onto something?
On the other hand, a student lounge is an entirely different story: that seems precisely like a designated space for students to spend down time. If you put a couch in your lounge, then you can reasonably expect people to at least take naps. It would seem like a much better idea to me to place a cot in the lounge rather than the lab itself. If you don't want to do this because there could also be other people there: well, again, the lab itself is not your personal sleeping space. I would think that you could ask even a senior grad student or postdoc "Hey, is it okay if I keep a cot in the lounge and sleep on it occasionally if I need to?"
Finally, although if the right people say so you certainly can sleep in/adjacent to the lab, I wanted to recommend that you give some thought to the work-life issues involved. In the long run, most people are much happier sleeping in a bed in a place of their own and also having some downtime / nonwork interactions between sleep and attending class. If you are sleeping nights in the lab with just a stored cot are you not showering / doing morning and evening hygiene / putting on clean clothes before you wake up in the lab and then go to class? This is most certainly possible and there are institutions full of large numbers of students who do it (I frequented an all-night cafe at MIT as a graduate student and encountered many students there whose motto seemed to be "No shower until I finish this week's problem set". It wasn't pretty.) But nevertheless most people realize that this is just less healthy, less fun and even less productive than doing things in a more balanced way. For that matter, what is it that you're doing in a lab for hours past the time that everyone else goes home? Is all that time really needed? I mean, intensity is great, but after a certain point it gets a little manic. Many of the most successful academics that I know work incredibly hard in a certain sense; but I don't know any leading academic that literally spends all their waking hours working. You just can't do good work for that much time. Anyway, it's worth thinking about.