If it switches while the phone's display is on there's something wrong; this should not happen. As you have read, it WILL switch to cellular if the phone is asleep and not plugged in.
The first thing to check is your router. Turn it off or unplug it for 15 seconds or so. Verify that it has the latest firmware update by checking the manufacturer's web site. Also look for sources of interference. If you have 2.6 GHz cordless phones they can cause interference to WiFi. Do you have a lot of WiFi networks in your neighborhood? If so try choosing a different channel in the router (other than 6 or 11).
On the phone try "forgetting" the network, then connect again.
On the phone go to Settings/General/Reset - Reset Network Settings.
One of these will probably fix it. Unless it happens with all WiFi networks, not just the one at home. If it is all networks you have a bad WiFi chip; get the phone replaced by Apple.
I have not seen it switch when I have the phone on, but if I "make ethe screen black" (by hitting the button on the upper right cormer of the phone..lol...I assume this is what you mean by putting the phone asleep.), then it will show 4G and then switch back to wifi. We have a brand new "whiz bang 5000" router and so I will try this reset of the phone after I close here. Thanks for your help. Sorry I am not more tech talk savvy....