As mentioned, using tape can help. Just be careful when taking the tape off, you don't want to hurt your ear.
If you have some spare money, then you can also try the sports earphones, the ones that loop around your ears. I've never tried them myself, but they seem like they would stay on without any troubles.