What do I do with the third set of wires in this switch box?
You only need the one set plus the switch legs, so you really have two extra sets. It's impossible to say without knowing where and what they are going to, but more than likely the circuit is simply splitting off to feed different branches of the same circuit.

You can safely connect all neutrals together and all grounds together. The live conductors are less certain, but most likely they can be all connected together as well. The only thing that is not connected to like conductors would be the return from the switch, which would go directly to the light. The other light terminal goes to all the neutrals.

To determine where the extra sets go, (one obviously goes to the switch, but it goes beyond that as well) safely isolate all wires so they cannot touch each other or anyone or anything else. Turn the power back on. Anything that doesn't work is where the wires go. Of those things that don't work, what ever boxes are closest to the light and switch is probably where the wires run directly, but there is no guarantee without getting into other boxes and checking continuity back.