That router is a 2.4 GHz-only 300 Mbps 802.11n router, not ac. 300 Mbps is the optimal bandwidth using two channels. If only one channel is used, you get 150 Mbps.
Roughly half of that is used for error correction data, so ideal real-world transfer speed is about 75 Mbps.
If you're more than about 5 meters from the router or if there's RF noise, speed will drop. So I'm not surprised you're only getting 40 Mbps.
The obvious fix is to replace your router with a new one that supports 802.11ac. The slowest speed of 802.11ac is 433 Mbps (about 216 Mbps ideal, 100-150 Mbps at distance). Most routers will do 866 Mbps, which will get you about 200-400 Mbps in real-world use. 802.11ac is 5 GHz-only as well, so suffers less interference.
If you want to try improving the situation with your current router, go into its settings and make sure channel bonding / wideband is enabled (300 Mbps instead of 150 Mbps). And do a site survey to see what 2.4 GHz channels are being used. Try to set the router to a channel which is relatively clear. (Only channels 1, 6, and 11 are independent on 2.4 GHz, since each "channel" actually covers 5 channels. So 1 is 1-5,, 6 is 6-10, etc.)