HAD BETTER = strong advice/warning (you should do this, or something bad will happen). WOULD RATHER = preference (I prefer this option).
Quick tip: HAD BETTER = strong advice/warning (do this or else!). WOULD RATHER = preference (I prefer this). HAD BETTER + base verb. WOULD RATHER + base verb (for your own action) or WOULD RATHER + past simple (for someone else's action).
HAD BETTER = Strong advice/warning
Use HAD BETTER to give strong advice or a warning. It means 'you should do this, or there will be negative consequences.' More urgent than 'should'.
You'd better hurry, or you'll be late. (strong advice - warning about being late)
I'd better leave now. (strong advice to myself - or I'll be late)
We'd better call them. (strong advice - or we'll have problems)
You'd better not forget. (strong warning - negative consequence if you forget)
WOULD RATHER = Preference
Use WOULD RATHER to express preference. I prefer this option over another. Structure: would rather + base verb (prefer to do) or would rather + past simple (prefer situation).
I'd rather stay home. (I prefer staying home)
I'd rather go to the beach. (I prefer going to beach)
I'd rather you didn't smoke. (I prefer that you don't smoke)
Would you rather have tea or coffee? (which do you prefer?)
WOULD PREFER = Similar to would rather
WOULD PREFER means the same as WOULD RATHER, but uses 'prefer' + infinitive. I'd prefer to stay = I'd rather stay.
I'd prefer to stay home. (same as: I'd rather stay home)
I'd prefer not to go. (same as: I'd rather not go)
Common mistakes
Not "You better hurry." — say "You'd better hurry.". Use HAD better (contracted: 'd better), not just 'better'. Had is required..
Not "I would rather to stay." — say "I'd rather stay.". After WOULD RATHER, use base verb (not infinitive with 'to'). I'd rather stay (not 'to stay')..
Practise it
Strong advice/warning? HAD BETTER. Preference? WOULD RATHER. Had better + base verb. Would rather + base verb.