iPhone OS disables push notifications when your device is asleep, on battery power, and on wifi only (ie. no cellular data connection). Plugging into a power source (USB or wall) will enable push notifications while sleeping.
EDIT: From the iPhone Dev Center:
WiFi is used for push notifications only if there is no cellular connection or if the device is an iPod touch. To receive notifications via Wi-Fi, the device’s display must be on (that is, it cannot be sleeping) or it must be plugged in.