The trick is to put the layer in a group, then add a mask to the group:
Does that make sense? That way, you keep the gradient untouched, and do your brush work separately.
In some cases, it's better to do the brush work on the layer mask, and the gradient on the group mask. The more you play with this method, the more you'll develop the instinct for what's best.