I don't have that problem either and the "Ask to Join Networks' is "ON." If my phone is connected to EDGE, while I'm on the road, it stays that way until I first unlock it near my WiFi connection at home. It takes a few seconds for it to change, but it is done automatically. After that, as long as my phone is near the router, it stays connected to the WiFi connection even when I lock/unlock.
By the way, are you close to the router? I mean sometimes mine does that, but it's usually because I got out of the routers range and it went to EDGE to get my emails. But if you are close to the router and as soon as you lock/unlock it drops the WiFi connection, you may want to call up tech support and see what's going on.