Few pieces of gear are as important for your comfort and safety in the backcountry as your shelter. But tents, like rainjackets and anything else with a water-repellent coating, wear out over the years. And leaks can sneak up on you—you usually don’t notice them until you wake up in a puddle during a rainstorm. We talked to Glen Young, a mountaineering guide with Seattle-area Miyar Adventures, for advice on how to maintain a tent so that doesn’t happen to you.

The easiest way to keep your tent waterproof is to take good care of it, he says. Waterproofing breaks down when dirt and oil are ground into the fabric, so make sure to wash and dry your tent after use, and avoid stepping on it while setting it up and taking it down. But here’s what you can do to repair yours if things start to get soggy.

When to Re-Waterproof

The first question to ask yourself is: Does my tent need work at all? If stored and cleaned properly, tents don’t necessarily need yearly maintenance. There are plenty of reasons you may be getting wet that don’t require repairs. If your ground tarp is sticking out from under the tent, water can collect underneath you. If a double-wall tent isn’t properly staked out, the fly can stick to the tent body, allowing water to run in. But if there’s no obvious explanation, and you’ve been camping in dusty, rocky places, it might be time to re-waterproof. Start by hand-washing the tent with a gentle soap and drying it in a shady place, then address each piece one at a time.

The Seams

Tent seams are generally factory-taped. Over the years, the lamination will come off, allowing water to run inside. If your tent is single -walled, these seams are part of the body, and if it’s double-walled, they’re on the fly. You’ll need to reseal them with a purpose-made silicone sealant—Young uses Gear Aid’s Silnet ($8). Because you’ll apply it to the interior of the seam, it helps to first turn the tent or fly inside out. Remove any peeling tape, and spread a thin layer along the length of the seam. Use a popsicle stick to smooth it out (you want the thickness of butter on toast, about a millimeter). Young says that if one seam is leaking, it’s likely that the others will begin delaminating soon as well, so it’s worth sealing all of them at once. After you’ve applied the sealant, let it cure in the shade for about six hours. With retouching, it will last years: Young has been using one resealed tent for a decade.

The Fly

First you’ll need to inspect the tent fly inch by inch for any small rips. If you find them, Young recommends patching with Gorilla Tape or Tenacious Tape ($5), both of which are waterproof. Once you’ve patched the fly, you can renew the material’s waterproofing. If your tent is single-walled, it’s likely made of a waterproof-breathable material akin to Gore-Tex that needs a technical waterproofing, using something like Nikwax TX.Direct ($22). (Every waterproofing is applied slightly differently, so follow product directions.) For flies and tarps, Young uses Nikwax SolarProof ($19), which adds waterproofing and prevents sun damage. To apply, just spray on the Nikwax, using a sponge or cloth to even it out, then wipe off any excess with a rag, and allow it to dry. If the tent is made of nylon, he also uses Scotchgard Heavy Duty Water Shield ($10), but this can damage other fabrics, so check what your tent is made of first.

The Tent Base or Ground Cloth

The base of the tent body and the ground cloth are the most likely to wear out, as they are frequently in contact with the ground. Fortunately, the repair process is very similar to the that of the fly. Again, start by inspecting each piece for tears, and fix them with your waterproof patch of choice. Then use a spray or wash to waterproof the fabric. Let the tent base dry with the fly off, in the shade.