Noise is almost impossible to completely eliminate, particularly if your bass or guitar has single-coil pickups. While many modern instruments have found workarounds to minimize this, older guitars and basses typically are the noisiest. A noise gate is a one idea, so that when you’re not actually playing, volume is reduced to zero and thus there’s a perceived drop in the overall noise level. Once you start playing again, the noise will likely be masked by all the other sounds bouncing around on stage or in the studio.
However, there are some guitars and basses that have more noise than what you’d consider normal. If you notice that the noise level (including 60-cycle hum) is greater when you take your hands off the instrument, you may have a simple problem that’s easy to fix. Typically, you’ll find that guitars with single-coil pickups (and even some with humbuckers) have the control and pickup cavities sprayed with conductive screening paint. If these are not connected to an earthing point (or if the connection perhaps came loose at some point), it’s a simple matter to have a qualified tech hook up the cavities with copper tape and additional conductive paint. Almost all guitars and basses are given quality-control checks before they leave the factory these days, but if your instrument was purchased used or is an older model, you might want to have this checked out.