My Galaxy Nexus has this same wifi problem as well. I've narrowed it down to turning on cellular data for my phone. If I restart the phone with cellular data turned off and wifi turned on, the phone will sleep without wifi dropping out. However, if I go out I usually turn wifi off and cellular data on. When I get back home, I reverse this and turn data off and turn wifi back on. At this point, wifi will drop out when the phone sleeps. To get wifi to stop dropping out I have to restart the phone again with wifi on and cellular data off and the wifi dropping issue is gone again until the next time I turn cellular data on and wifi off.
I just figured this out the other day and haven't had time to test any variations. Also, there is a thread going on over at XDA with several people who have this same problem as well. No solutions yet. I would link to it but I'm not sure if that is ok here or not.