It's easy to use good form on push-ups... until you start to fatigue. Instinctively, we try to make it easy to keep going by sagging the hips. This effectively lightens the load and shortens the range of motion. But of course that's incredibly bad form too.
To fix it fast, simply bring one knee up to touch the same-side elbow. That puts you back into correct alignment. Now, keep that form and continue to do reps.
If you're unsure about your starting hip position, just use this same cue before beginning a set.
It's a fact: the exercises that make you hate life the most also tend to deliver the best results. If you're in serious need of a hamstring overhaul, then this article is a great (although painful) place to start.