I had success with an iPhone 5 I just got on T-Mobile that was having the same issue. I selected my home wifi network, entered the password, after I put the phone to sleep the wifi password would need to be re-entered. What I did to fix the issue was to go into settings > wifi > other > then enter your wifi name and password and under security choose WPA.