Outside of just cleaning it every once in a while and keeping it in a clean area, they do make keyboard covers
https://www.amazon.com/Computer-Keyboard-Skins/b?ie=UTF8&node=3015407011 But since many laptops use the keyboard area to expel some heat and the skins will change the feel of the keys, you may want to just keep the system clean normally by watching where you use it and cleaning it with a soft brush and some air. I like to use the toy water gun foam tubes instead of buying compressed air cans.
Most replacement keyboards are pretty cheap also, unless you have a higher end gaming laptop. I have bought keyboards for $20-30 online for many models, you don't need to live with broken keys.