If this is the first time this has happened, then something has changed, and it might be obvious. For instance, are your shoes worn out? Did you significantly increase your training volume? Did you start running on a different surface? If none of those things have changed, then you may be in an over-trained state and pain is showing up in your hamstrings.
Try this:
1. Massage your hamstrings. Use a foam roll or massage stick to loosen up knots in your muscles.
2. Mix up your training. Try cross training in the pool (running in water or swimming) one week a month so you’re not always doing the same thing and putting the same stress on your body.
3. Taper your training volume every third week. Cut your mileage by a third to a half to give your body time to recover. You can still train just as hard.
4. Strengthen your glutes. If your glutes are weak, your hamstrings will have to work overtime to pick up the slack. So include mini band walks in your workout to strengthen your glutes, and make sure you’re feeling it in your glutes and not your hamstrings.