Be careful on roadways. That said I do it all the time, but in parking lots, not street parking. Street parking you make me nervous.
I have only be 'hassled' once. A police offer knocked on my windows one night in a bar parking lot. It was about 6am and I just stayed in bed. (I only know it was police based on reflections of their lights through my roof vent) I figured if they were really interested they would get a warrant and come back or be more persistent. They left after a minute or two.
My van is such that you cannot see into the living quarters at all, so I chose to remain silent. It might be very different if I was still sitting there drinking with the lights on.
The key issues is that if you have the keys in your possession you are viewed to be operating the vehicle in some jurisdictions. I think a little common sense and courtesy goes a long way. Whether you were driving or in control of a vehicle is a question of both fact and law, but you don't want to get to the place where you need a trial to determine those issues. Don't look to the police like you are about to drive, or drove drunk and most times you can avoid arrest and ticketing.
You can always be arrested and the facts can be argued later, but it is better to avoid the issue in the first place. If you are legally in a place you can remain overnight you are less likely to be hassled. If sleeping in your vehicle is illegal you are in the position of arguing you were going to avoid driving while intoxicated (one crime) by sleeping in your vehicle (another crime). Don't put yourself in the position of making that argument.