Put in too little and you live a life of a pauper for 20-40 years after you retire. That is, if you can ever retire. And if you don't retire, why put any into a 401k (beyond the company match of course)?
Put in too much and you waste your youth.
A general rule-of-thumb is that you need to have ~17% of your salary saved/invested each year. If you save 17% for 40 years, get raises that match inflation, get a historically average rate of return on your investments, and withdraw at the commonly recommended rate to have your retirement savings last then you'll retire with EXACTLY the same income as you had when you were working. That is the perfect balance to me. You have a smooth transition from work to retirement with no change in lifestyle needed. No wasted youth and no poverty in retirement.
Of course, that 17% will be dropped by other factors. If your company puts in 5%, then you only need to put in 12%. Also, in addition to a 5% company match if social security is around and pays 5%, then you only need to put in 7%. And that savings doesn't need to be only in the 401k. Emergency savings and house mortgage principal count as well, so you can drop the 401k contribution even further. But, note that emergency savings and housing usually don't return as much as stocks, so don't drop much below 7%.
Other factors also affect the amount. A large inheritance means you can invest less. A few years of not saving (lost a job, or over-spent at some point) means you need to invest more.
I'm also at 18% in my 401k right now but I change it frequently.