It can help to not make every keyframe type smooth to gain more control over the curvature. In your smooth example, to prevent the portion between keyframes 2 and 3 from going into reverse, change keyframe 2 to linear. Then, it will still curve into and out of that portion. See also