Slide 2 shim pieces -- thin portions of wood -- into each side of the gap between the joist and the floor above.
Make a mark on each shim with a pencil. Remove the shims.
Apply construction adhesive to the marked portion of the shims.
Place the shims into the gap up to the marks.
Cut the shims with a utility knife at the marks. The shims should now fill the gap.
Measure the length of the gap between the joist and the flooring above. Use this measurement to cut your 2-inch by 4-inch lumber to length.
Drill 3/16-inch holes every 12 inches along the a 2-by-4 at a slight diagonal upward.
Apply construction adhesive to one side of the 2-by-4.
Press the 2-by-4 onto the joist with the top touching the floor above, covering the gap.
Drive two 1/2-inch wood screws into the 2-by-4 into the joist to stop the squeak.