Use this guide to replace a malfunctioning volume control cable—this includes the electronic switches responsible for volume up and down, and the ring/silent control.
If you're looking to replace the physical button covers, we have a guide for that too: iPhone 4 Volume and Volume Control Buttons Replacement