Liverpool moved to within four points of the top four as Raheem Sterling and Joe Allen's goals condemned Newcastle to a fifth straight defeat.