If you have the "mechanical" friction pegs with the tension screws, and the screws won't tighten enough to hold the strings in tune, it means the plastic peg buttons are compressed. The screws can't go any farther.
You can take the peg apart and either add a small washer between the screw head and the top of the button, or make a washer out of leather or soft plastic and put it between the bottom of the button and the metal housing it sits on. This will allow the screw to be tightened a lttle more.
These screws shouldn't be any tighter than necessary to hold the string in tune, or the buttons will become compressed prematurely.
If you have wooden violin-style pegs, the various remedies already given work. Sometimes I use "peg dope" (jeweler's rouge) or blackboard chalk for the peg to have more grip in the holes.