Broken sunglasses are a serious nuisance, but basic repairs can be performed at home with a little knowledge and standard materials. Scratched lenses, loose frames, and missing screws are common problems that can be corrected easily. Reversing serious damage to frames and replacing lenses is more difficult, but still doable with intermediate know how.
Many difficulties arise from wear and tear. Loose screws around the hinges and where the frames attach to lenses are a frequent complaint. To fix this, tighten or replace these tiny screws with a special small blade screwdriver available at most hardware and eyeglass stores. Applying a thin coat of nail polish over screws is also recommended, since it helps prevent new looseness.
Completely broken frames demand more intensive repairs. For plastic frames, heat both ends of the fractured parts with a lighter (place the plastic over the flame, not in it) or boiling water until they are nearly melting. Then insert a thin metal pin into one end, and re-connect the severed parts, holding them together until the plastic cools. Note that the glasses probably won't look pristine after this, but they will be usable again.
Scratched lenses often plague sunglasses. For plastic, the fix is simple. Armour Etch and similar products are able to fill in minor scratches and cuts to lens surfaces. Just dab it over the affected areas, and then run hot water over the lenses for a couple minutes.
You can put lenses that have popped out of frames back in place using the same screw replacement technique mentioned above. Locate new screws, and then drive them in place with help from a magnifier, sealing the lens back where it belongs. Completely shattered lenses will have to be ordered from the manufacturer, though, before you can replace them.
Don't hesitate to look up model specific information for the most effective repair. With these methods and regular maintenance, your sunglasses can be reliable for many years.