If the latch does not catch, close the door slowly to watch how the latch bolt meets the strike plate.
The bolt may be positioned above, below, or to one side of the strike plate. (Scars on the strike plate show where it is misaligned.) It is also possible the door has shrunk and the latch no longer reaches the strike plate. Once you have figured out the problem, try one of the methods shown here.
On mortise lock sets (the type that fit into a large slot in the edge of the door), doorknobs may become loose over time. To tighten them, loosen the setscrew on the knob's shank. Hold the knob on the other side of the door, and turn the loose knob clockwise until it fits snugly.
Then tighten the screw until you feel it resting against the flat side of the spindle. The knob should turn freely. If this does not help, remove the knob and check the spindle; if the spindle is worn, it must be replaced. If the whole lock set is worn, it is best to replace it entirely.