Clean the rug thoroughly. Vacuum with a vacuum cleaner and shampoo with a rug shampoo. Rinse and dry completely. It is important that the colors of the rug threads be as clean as possible when you match the colors with replacement threads.
Examine the rug from both the top side and the underside. Sometimes a frayed section is where the rug threads rubbed away but the underlying backing fabric is still intact. Sometimes the backing fabric is no longer intact and you need to replace it.
Select a backing fabric that is as close as possible to the thread weight of the existing rug. Use tweezers to remove or untie the knots 1/4 inch along each side of the missing fabric section. Paint any loose thread ends with nonfray or glue to prevent further fraying. Match the backing fabric sections together (working on the back side of the rug) and glue the overlapping areas with a strong fabric or rug glue. Allow the glue to dry completely.
Select threads or yarns in colors that match the existing colors on the rug. The yarns or threads should be of the same weight and thickness as the rug threads.
Match the knot pattern and color pattern of the existing rug on your new section of rug. Use both curved and straight needles as needed. Trim the threads with scissors to the same pile height as the old rug. If necessary, finish the edge of the rug with an edge binding stitch or with handmade fringe. Match the edge with the existing rug.