Of course of you have wifi and 3G on, if there is no wifi then it will use 3G.
The OP was suggesting that his phone uses 3G when his screen is off even though wifi is available. Unless for some reason the wifi signal becomes unavailable or to weak during the night there is no reason why the phone would switch to 3G automatically...
Do you have any messenger app in your iPhone? Like Nimbuzz, or Skype, or Yahoo, or Msn messengers? If you happen to have anyone of those then try this and let us know the results. Note that I'm talking about iOS < to 5.
Disable "My 3G" or "3G unrestrictor"
Turn off "data network"
Make sure that you are on wifi and lunch anyone of those messenger, after a successful login, turn off the display and leave it sit there for about 15mn or so. After that, press the home button, tap on the messenger app icon you are testing and you will notice that it will now try to reconnect again to Internet.
If your results are like I said, then here comes a question. Why will the messenger get disconnected while the phone was sleeping even though the device was connected to wifi. Only one answer to that question is because you've turned off the data network.