Would it be acceptable to occasionally sleep at the lab?
Ask your supervisor. If your PI supervisor controls the space and gives you permission, there shouldn't be any problem for you.

I've seen situations where there are experiments that need to be babysat over long periods and researchers bring cots into the lab so that they can devote more time and provide more frequent checkups than would be possible otherwise.

Of course, if you are homeless and living in the lab for some longer period of time to avoid paying rent somewhere else, that seems like a much bigger problem. Honestly though, I've seen that done as well. The OK-ness and consequences of sleeping your lab will depend on the local culture, rules, and laws. If you ask a supervisor, it will be their responsibility to make that call.