Step 1: What You Need
A pair of boxers or other thin fabric
An electric bass
Step 2: What to Do
Take the boxers, and starting from the highest string (g) run them under, between the bridge pickup and the bridge, or if you have a P bass, just by the bridge. Run the legs through, so that the waistband is near the knobs (if your bass is a normal design). Try to even out the fabric so you have the same under each string.
You should now have excess fabric after the E string (or B, if you have a 5 string).
Twist the fabric on each end of strings (one hand at the highest, one at the lowest) opposite directions so the strings hold it in place.
Take the excess fabric and run it under the lowest strings (E and A, and B with a 5 string), leaving a little tuft at the D string.
Play around! Push the fabric around until it gives you the sustain you want. Normally you will come pretty close the first time, but it can't hurt to perfect it!
Tips: More twists will increase the sustain. The lower strings will have more sustain, so you wont want these as tightly would as the G and D. Keep everything as close to the bridge as possible.