Other than buying sports earphones, the simplest solution is to hook the earphones over your ear. Although not entirely foolproof, this prevents the earphone being slowly pulled out of your ear, or at least reduces how often it happens. Your ear absorbs some of the tugging, and the positioning within the ear canal is generally more resistant to the earbud being pulled out.

[![Earphone with cord passing over earlobe][1]][1]

(Source https://i.sstatic.net/fcCW0.jpg)

  [1]: https://i.sstatic.net/fcCW0.jpg