Re-posting: https://www.macissues.com/2015/01/15/sleep-and-power-settings-possibly-behind-wi-fi-dropouts-in-yosemite/
Along with its perks and new features, OS X Yosemite has not been without its share of problems, with at least some of these being associated with the inability to keep your Mac connected to Wi-Fi. If this happens, there are some basic fixes from toggling Wi-Fi off and on, to fully resetting your Mac’s network configuration; however, there are times when these might not work, and your Mac will continue to drop its connection.
If this happens, then you might find yourself regularly restarting, logging out and back in, or otherwise repeating tasks in hopes to clear the problem, but this might be somewhat fruitless, and the fix might in fact be with some lower-level settings in your Mac.
pmset -g custom
In comparing the two sets of settings, the only difference was the “sleep” option was set to “1” when on the MacBook for when the machine was plugged in:
AC Power:
lidwake 1
autopoweroff 0
autopoweroffdelay 14400
standbydelay 86400
standby 1
ttyskeepawake 1
hibernatemode 3
darkwakes 1
hibernatefile /var/vm/sleepimage
womp 1
displaysleep 10
networkoversleep 0
sleep 1
acwake 0
halfdim 1
disksleep 0
To see if this sleep setting was the issue, Bob ran the following command to turn off sleep when the system is on AC power:
sudo pmset -c sleep 0
(Note that this can also be done by going to the Energy Saver system preferences, selecting the Power Adapter mode from the list of tabs in the middle of the preferences pane, and then dragging the sleep slider to the “Never” setting; however, it may also be beneficial to run the command in the Terminal, which will toggle it in another way.)
After running this command, Bob noticed the system’s network drop-outs no longer occur.
While successful here, this case isn’t to say that the sleep setting itself or the behaviors around it are solely responsible for network connectivity issues, but perhaps the problem stems from faulty storage or retrieval of these settings. For instance, “sleep” value is not merely 1 or 0, and instead is the number of minutes the system waits before going to sleep mode. This value should also be reflected in the slider position in the Energy Saver system preferences; however, you may notice that after upgrading your system, these may not match each other. For instance, on my Macs, upon upgrading to Yosemite the power manager setting was at “1” for all, when the Energy Saver preferences had 10 minutes set for system and display sleep.

To adjust the “sleep” power manager settings in OS X, drag this slider around. To set it to 0, drag the slider to the “Never” position.
Therefore, whether or not this seems related, if you are experiencing network connectivity problems, then a quick toggle of these settings, or a reset of your Mac’s hardware settings, may help your situation out.
To reset your Mac’s hardware settings, simply shut it down and follow the instructions in this article to reset your Mac’s System Management Controller, followed by immediately resetting your Mac’s PRAM when you next start it up, by holding the Option-Command-P-R keys simultaneously when you hear the boot chimes after pressing Power, and holding them until the system’s screen goes blank and restarts again.