Squash borer! What now?
If your squash plant looks like this, chances are good it has squash borer. You can avoid this by (1) not planting squash in the same place each year, and (2) inspecting the plant stem base as it grows. (Also, you could spray for the moth that lays the eggs at the stem base if you know what the moth looks like and when it is present. But most of us don't know that)
So the first defense we can do easily by planting our squash in a different area of the garden than last year. The second defense, inspecting the stem must be done daily. Look for small hole bored into stem. Usually some fras, small yellow piles near the hole, will be present as in this photo:
The chances of saving the plant are much better when you do not wait for the plant to wilt. The process now is icky. Split the stem, find the borer and destroy it. The borer is a light colored worm with a black head. In this photo it is at the end of the knife blade. You may find more than one.
Then pile soil over the wound and water. And pray. The chances are good the plant will continue to grow and produce.