Fernando Alonso will stay at Ferrari at least until the 2016 season after extending his contract with the Italian squad.