In 1976, neither Ford nor Reagan had enough delegates to clinch the nomination, although Ford was leading.
1976: The Last Time Republicans Duked It Out To The Last, Heated Minute • 2016 Mar 14 • NPR
Right now, the gap between Trump and Cruz is a little more than double the gap between Ford and Reagan in the final tally at the convention, but there are still over 1,000 delegates available in the rest of the primary season, and Trump would have to win more than half of them to cross the nomination threshold.1
This scenario is also still possible for Clinton and Sanders, although the gap is wider (almost 3x the difference between Ford and Reagan). Unless there are major unforeseen landslides down the road or Sanders bails before the end, it doesn’t seem like Clinton will cross the nomination threshold before the last day of the primary either.2
Reagan primaried a sitting president (albeit one who was appointed, not elected) and while he lost to Ford, 1976 was clearly a stepping stone to 1980.
So if you’re thinking about the long game of future elections and/or the broad game of winning Congressional seats and state and local elections, it really doesn’t make sense to drop out while you’re still technically viable.3