Prepping the Molding
Reattach any loose molding by tapping it into place with a rubber mallet or a hammer wrapped in a towel to avoid denting the face. Check that it meets any joints or corners as tightly as possible. Using a small amount of wood glue in joints will help to ensure its position. Use masking tape to hold them tight until the glue is dry.
Clean the molding with a solution of warm water and detergent before caulking the chair rail. Use a towel or sponge to wipe off excess moisture. Use a scraper to gently remove any glue, old caulking and debris along the top and bottom of the chair rail.
Use painter's caulk for all painted moldings. For stained pieces, a dap type product the same color as the wood will give best results.
Apply the Caulking
Cut the tip of the caulking nozzle to create an opening about the width of the gap you want to fill. Poke through the nozzle to open the foil seal with a long nail or screw. Push the thumb button on the caulking gun to release, and pull the plunger back. Slide the caulk into the gun, and push the plunger up. Pull the trigger until the caulking rises up in the nozzle.
Apply caulk to the chair rail by inserting the nozzle into the seam at one end of the chair rail. Squeeze the trigger evenly to apply an even bead, allowing the caulk to build up slightly. Try to fill the seam in one movement if possible. Use a wet finger to smooth the caulk into the seam. With a damp rag, wipe any excess caulk from the wall and chair rail.
Repeat the procedure for all remaining seams and joints.