If the router needs restarting and that fixes it the problem is likely to be the router, and in that case you should buy a replacement, however call Apple about the keyboard first as if it isn't just a broken keyboard it could possibly be the Mac.
I only bought router last week because the other one died, maybe a os x reinstall is in order?