If you're using Play-Doh specifically, Hasbro's FAQ tells you this:
Play-Doh compound is designed to use over and over again. If allowed to harden (to preserve a creation) it will most likely crack.
Look for oven curable clay at your local craft stores to make long lasting creations.
Which isn't helpful, since it essentially says "you can't".
However, you can attempt to bake and seal it. Drawing some information from this guide, we can get started.
Start by preheating your oven to 200°F or 90°C. Make sure your Play-Doh sculpture is stable, and place it on a sheet of aluminum foil on top of a cookie sheet or something comparable.
Bake the sculpture for 10–15 minutes. If you have thicker parts on the sculpture, you'll have to bake for longer.
I recommend making some test sculpture, like simple tubes, of different thicknesses. By baking these, you can test out how long it takes in your particular oven. You can test if the bake was long enough by breaking the test tube in half and making sure the moisture is gone from the center.
After it's baked, you'll need to apply a varnish to seal the sculpture. You'll want a product that's water proof, and most will do that. Avoid spray varnishes, because the propellant chemicals may affect the sculpture over time. There are varnishes specifically for sculptures, but some people have had success with sculpture by using clear wood finishes.
- When you apply the varnish, make sure you get every spot. Use a fine brush to get into crevices. After the first coat dries, go back over to get the bottom of the sculpture and wherever you held it.
And that should do it. Of course, I would test it with a lump, first, to make sure the varnish you're using doesn't result in a sticky texture or soften the Play-Doh as you apply it.