When I am downloading large files I need to stop my phone from sleeping , how do I keep my wi-fi on when the phone is in sleep mode.
Go to: Settings > Wireless & networks > Wi-Fi settings.
Hit your Menu button and select Advanced. You should now see an option for changing the Wi-Fi sleep policy.
For Android 4.0 (Ice Cream Sandwich) and later upto Android 5.x (Lollipop)
For previous versions of Android(i.e. 2.x) please consider Rohan Singh's answer.