Default wifi problems

hi, my phone will connect to wifi but after it being locked for about 10-20mins it will loose wifi connection and not reconnect unless i turn wifi off and back on again really really annoying.