How old is the keyboard? Sometimes "gunk" gets built up under the keys and can cause the keyboard to start failing. Have you tries to remove the keys (or take the keyboard apart) and properly clean it? There are plenty of tutorials (video and non-video) available if you are unsure of how to clean a keyboard.
Regular cleaning on all computer parts will extend the life of those parts.