Keep (one's) wits about (one) phrase
To be able to think quickly and prepared to take necessary actions in an unpleasant or dangerous situation.
If I hadn't keep my wits about me when the gunman stormed into the room, I would have died.
By keeping his wits about him, John was able to rescue the kids from the burning bus.
I had got lost in the woods, but luckily I kept my wits about me and successfully found the way out.
The verb "keep" must be conjugated according to its tense.
The origin of this phrase is not clear.