Some places are more safe than others. Trust your gut, and what others tell you. The best place to sleep is in a house in a bed. We all know that. But you dont have a house, and most likely dont have a bed.
Therefore, check out couchsurfing.com to find a friendly bed near you. You may hve to do some serious asking multitudes of people, after all its a free site, hosted by people with lives of their own. So try it first. If you cant get a place on there….
You can try local community shelters. However shelters are often filled with the homeless people who are homeless because of outside circumstances. Most of these people are lovely people to chat with, but some are paranoid, drunk, theives. So hold onto your valuables tightly.
If you have a car, this is also another very safe method, contrary to popular belief. The most hassle you may have to deal with is construction in the morning waking you up, or an occassional cop making sure you are not dead, or taking up a private spot. As for where to sleep in your car, wal-mart parking lots are great, you can use the bathrooms 24 hours a day, and there is security as well, and usually a bunch of other people sleeping in their cars / motor homes around you. if you cant find a lot like this, you can sleep at bus / train stations, churches, apartment complexes, houses that are up for sale and vacant, and the list goes on. I dont recommend parking garages, or private lots, as you might be woken up by the sound of a tow truck hauling your car away, who may still charge you even though you are in your car.

If you dont have a car, the best thing to do is sleep during the day, and move at night. You can sleep in public parks with no hassle, (yes even central park) landromats, libraries (sometimes), beaches, college campuses, the subway, the bus, the bus stop, behind buildings, rooftops, ect.
At night its a different story. I have seen people sleep in multitudes of places, some out in the open, some hidden very well. Most people who do sleep at night find places off the beaten path where their likely hood of being spotted by cops or other bums or college kids looking to f with them is slimmer. The problem with this method is that if something were to happen, you are secluded and generally helpless outside of your own self defense. I have seen homeless people make tents out of tarp and suction cups and sleep under store fronts, bridges, bushes, trees, parked cars, you name it, anywhere they can find they will sleep. Remember, if you are asleep outside someplace you are libel to be hassled, no matter what time of day.
Therefore, you can always look for a place to sleep inside. Some call this breaking and entering so be careful where you sleep. You could be arrested. i have slept in abandon houses, houses for sale, and college dorms during the off season, but you can sleep in barns, sheds, treehouses, basicly anywhere you can get in from the elements while not causing a scene.

I’ve been searching the question of where to sleep if I’m homeless for 4 hours now on the web and your answer, although dismal, is the closest to real and practical I’ve come across.
I have a male friend who has just become homeless and has not found a place or way to sleep for the past 4 days. I am terrified for him and frantic to find a solution. (I live too far away to provide shelter.) I now feel like if I can somehow help him make it thru this night I can talk him into sleeping during the day. Both of us never really thought about sleep during the day. Conditioning right – one sleeps “at Night”.
Thanks for helping me think outside the box!