Are you noticing them right after shaving, as in the shaving causes the irritation? Or are you just noticing that you're getting pimples? If you're just getting pimples, make sure to wash your dome before sleeping and wash your pillow case regularly.
If the pimples are due to shaving irritation, try using some shaving oil either alone or with shaving cream.