This is my best guess as to what is happening.
To save power your phone will turn off the wifi when the screen has been off for long periods of time, and then when the phone needs to sync it uses what ever data source is ready (4G/3G) cause it does not turn off. My suggestion would be to go to...