My son is a bit younger, 4.5 now, but we got him to stop last year kind of by accident (after trying the bad tasting nail polish with no luck). One night after dinner my husband, who our son adores, just started making noise on his glass with his nails and DS thought it was so cool and wanted to make that noise too - and of course he couldn't because his nails were way too low. So every day he tried the clicking of his glass until he finally made the noise - he was so proud of himself! Even now, every so often he'll click his glass and say "listen...I haven't been biting my nails!"
I'd guess this won't work for everyone, but it just happened to work for us.
Best of luck!