I recommend getting some timber cutoffs and trimming some filler pieces for the holes. I propose using Gorilla 59ml Glue Bottle to glue the filler pieces into the hole. Once the glue has cured you can sand off the excess timber and re-screw.
Should the screws pull out again, your other option is to use bigger and longer screws. - EricL
You can fill the holes and use the same screws. Even something as simple as a matchstick with some wood glue will often do the trick. - JDE
Buy some hardwood dowels, drill a new hole to suit the dowel, glue the dowel in place, drill new screw holes and use new screws of the original size. I have used this method on caravan cupboards (a violent environment), full-size doors and door frames.
Make sure you do not drill oversize holes – it will not work.
The question is why did the screws come loose? In most cases the screws are over-tightened in the first place. The other common issue is that that the pilot holes were too big.
The drill size should small enough to allow the screw to bite into the timber. Rule of thumb: the drill should not be larger than the main body of the screw. There are charts that list the size of drill bits for pilot holes for different screw sizes. - r23on