Please test after taking each of the following steps that you haven't already tried. Stop when the problem is resolved. Back up all data before making any changes.
Take the applicable steps in this support article. The Wireless Diagnostics program generates a large file of information about your system, which would be used by Apple Engineering in case of a support incident. Don't post the contents here.
Be sure to test on more than one Wi-Fi network, if at all possible. A desktop computer can be tested with a mobile hotspot, such as the hotspot created by a cell phone. If the problem only exists on one network, then the access point of that network should be the focus of your attention, not the computer.
Disconnect all USB 3 devices. If you don't know which are USB 3, disconnect all USB devices except keyboard and mouse.
If you're not using a wireless keyboard or trackpad, disable Bluetooth by selecting Turn Bluetooth Off from the menu with the Bluetooth icon. If you don't have that menu, open the Bluetooth preference pane in System Preferences and check the box marked Show Bluetooth in menu bar. Test. If you find that Wi-Fi works better with Bluetooth disabled, you should use the 5 GHz Wi-Fi band. Your router may not support it; in that case, you need a new router.
Open the Energy Saver pane in System Preferences and unlock the settings, if necessary. Select the Power Adapter tab, if there is one. Uncheck the box marked
Wake for Wi-Fi network access
if it's checked.
Open the Network pane in System Preferences and make a note of your settings in the Wi-Fi service. It may be helpful to take screenshots of the various tabs in the preference pane. If the preference pane is locked, unlock it by clicking the padlock icon and entering your administrator password. Delete Wi-Fi from the service list on the left by selecting it and clicking the minus-sign button at the bottom. Then recreate the service by clicking the plus-sign button and following the prompts.
In the Wi-Fi settings, select
Advanced... ▹ TCP/IP ▹ Configure IPv6: Link-local only
Click OK and then Apply.
Reset the System Management Controller.
Reset the PRAM.
Launch the Keychain Access application. Search for and delete all AirPort network password items that refer to the network. Make a note of the password first. Turn Wi-Fi off and then back on. You'll be prompted for the password when you reconnect. Save it in the keychain.
Make a "Genius" appointment at an Apple Store, or go to another authorized service center.