Rattling windows aren't just irritating -- they're also an indication of an issue that needs to be corrected. Rattling happens when glass settles toward the bottom of the pane and creates a gap between the glass and frame, or degradation of the frame due to repeated use over a long period of time. You may have to perform these tasks several times, and you'll need to continue to maintain rattling windows on a regular basis.
Examine the frame around the glass for cracks or loose caulk. Remove loose caulk with a putty or utility knife and apply a new bead of caulk around the entire window. Smooth the bead with the edge of the putty knife or with the smoothing attachment that may have been included in the packaging. Allow to dry according to package directions.
Apply a bead of caulk around the outside of the window frame, where the sash meets the trim. Smooth the caulk and allow it to dry completely.
Open the window all the way and measure the bottom of the track. Measure the track from the base up to where it's covered by the window. Cut pieces of rubber compression strips to size with a pair of scissors. Install the strips along the bottom and sides of the track according to package instructions.