It depends on how the UPF rating was achieved. If the weave or the fabric blend itself provides the protection, the item of clothing will hold up much longer in the wash. However, all fabrics have fibers that can be distorted in the long run, leading to less UV protection. Chemical treatments and dyes are also fairly resilient but they may lose some effectiveness after multiple washings, so you should replace sun-protective clothing every two to three years. You can also buy UPF-boosting products to put in your laundry.