It is best to use the gain as high as you can to get your desired tone. On most amps this will be as high as it can go before you start hearing distortion (or if there's a clip light, that light should ficker during your hardest playing efforts). Keep in mind that bass, mid, and treble controls are typically within the gain stage of the amp and will affect this setting too.
The Volume should be used to control your overall volume and is not supposed to be a tone altering device. Set this to the setting that gives you enough volume for your playing situation. One thing that really confuses most people about the volume is that you're limiting your amp's output with it. Please know that even if your volume is set to 5/10, you can still use all of your amplifier's power if you get enough signal through the preamp (what the gain knob controls). This is a point of confusion because people think that a volume knob at 5/10 on a 600W amp leaves you with 300W available. Not true. All 600W are available, and you are not reducing "headroom" by turning down the volume knob.
This method of setup gets you the lowest noise floor (least hissing/humming, which all amps have to a small degree). As for the volume on your bass, I just leave mine fully open so I get the most level from my bass. I almost never touch it, just leave it cranked.
I hope this helps.