I don't have access to a ESPP anymore, but when I was, I'd buy the maximum that I was permitted to at a discount every cycle. And I would keep most of it, because the option existed to take the dividends that the company stock threw off as current income without incurring an early withdrawal penalty within my 401K. It never turned out to be important for me, but I liked the option of a small, backup income should I need it. The total amount I had invested never exceeded 15% of my total portfolio.
When the company that I was working for at the time was bought out, I just liquidated at that time, and rolled everything over to the new 401k. Which, I've learned since, is the wrong thing to do. Now I'm trying to unwind the rollover a little each year, by rolling a bit to my roth ira each year. All 401k's are definitely not created equal.