The former Liverpool and Real Madrid midfielder took over the reigns at the Bay Arena last October with the club 16th in the Bundesliga and propelled them to sixth position at the end of the campaign.
Alonso also led Leverkusen to the semi-finals of the Europa League in his first season in charge.
His previous deal would have expired next summer but Leverkusen have been impressed with the work Alonso has done so far and have rewarded him with an extension.
Expressing his gratitude for the faith placed in him by Bayer's board, Alonso said: 'I'm very grateful for the confidence Bayer 04 have shown in me. The fact we are convinced of the same ideas and direction on the pitch, creates close affinity and confidence between the club management and myself.
'There is also a very good and relaxed working basis day-to-day. That too makes working with my staff and all Bayer 04 employees great fun. I see last season as a positive. But I want more, exactly as the club does. We are now working on that with ambition.'
Sporting managing director Simon Rolfes then declared: 'Bringing in Xabi last October did attract a lot of approval but also scepticism at the same time.
'We were in a difficult situation and saw in Xabi a world star but also an inexperienced coach who had not yet been in charge of a top team.
'Nevertheless, I was convinced of his ability from the start and Xabi was convinced of the quality of our squad.
'We overcame resistance together and created the best of all perspectives for Bayer 04. The current contract extension is an expression of great appreciation and mutual trust.'
Alonso also represented Real Sociedad and Bayern Munich in a storied career that yielded four league titles and two UEFA Champions League trophies. The 41-year-old also won two European Championships and one FIFA World Cup with Spain.