Verb
quit while one is ahead (third-person singular simple present quits while one is ahead, present participle quitting while one is ahead, simple past and past participle quit while one was ahead)
(idiomatic) To stop taking risks before one starts losing.