Remove the register covering the vent. This usually can be done either with a screwdriver to remove the screws holding the register in place or by prying the plate from the vent.
Frame the walls, top and bottom around the vent's opening with masking tape. Keep the tape along the edge of the opening and not overlapping into it.
Rip off a piece of foam insulation stripping. Hold the piece along the length of the vent in the gap between the duct and the wall, top or bottom.
Push the insulation into the gap using the tip of a screwdriver. Don't force the insulation further than it will go.
Keep filling the gap with strips of insulation until it is flush with the duct and the edges around it.
Spread sealer over the insulation to cover it. Use a paintbrush to spread the sealer from the duct to the masking tape.
Allow the sealer to dry and peel off the masking tape. Replace the register over the vent.