I've had the same exact issue with my brand new stock-model 15" Macbook Pro 2.2ghz i7. My brother had bought a 13" about 9 months ago, and he's also consistently had this same issue. I was praying it wouldn't happen with my mac too, but surely enough, it is. It says the wifi is still on and connected, but there is no internet connection. The only known fix is to disconnect the wifi and then reconnect it, or to go into the network preferences and renew the DHCP lease. It happens sometimes after 5 minutes, sometimes after an hour. It seems to hold the connection if I'm doing things like downloading something or playing most games, but even some online games don't seem to hold the connection and it'll disconnect me in the middle of a match. It also happens almost every time it goes to sleep, or even if it's idle enough to let the screen go black.
I've been reading a lot of forums about this, and there are tons of posts of people experiencing the same exact thing - it clearly seems to be a software issue on Apple's end that has been happening to anyone that has upgraded to El Capitan or later. It is definitely not a router issue because it happens with any router, and my same router will hold the connections fine with any other device whether they're plugged directly into it or wireless.
The issue didn't start until it saved a second wireless network/password in my network prefs when I was at my parent's house. One of the suggestions was, when it is not picking up the connection again after the computer goes to sleep, to delete all the saved networks and start again from scratch. This temporarily resolved the issue, but then it inevitably starts back up again after a few hours or days - now even if I only have my own network saved and no other networks.
Apple reps keep linking the wifi diagnostics pages as their answer, and then say if that fails that it is the router issue. Why won't Apple recognize that this is a software issue with their OS? It needs to be addressed and fixed. It is unacceptable to spend over $2,000 on a computer that from the very beginning has an issue, to which Apple is denying even exists.
- - - -
amrESSAM said that he changed the channel on the router and it worked? Does anyone elaborate on this fix and how to do it? I'm not using a mac router, it's through xfinity, but I can change the settings using 10.0.0.1 in my browser.