I am pretty sure the wifi is not actually off when in sleep mode. Two examples: 1. iCloud backup only works (automatically) if phone is on wifi, plugged in and in sleep mode.
2. I kept my iPhone 4 after getting a 5. It has no cellular service. My son uses it as an iPod touch, and when the wifi is on, screen off, iMessages go through just fine, and show up on the lock screen even if I do not touch the phone.
This makes me assume either the wifi is on or it is somehow triggered to turn back on if needed.
I am no expert by any means, but I was just trying to reason it out.