Formula 1 and the Baku City Circuit organisers behind the race have been in negotiations over a new deal to keep the six-kilometre street venue on the calendar, with "positive" talks having been ongoing throughout the F1 weekend.
Baku has been able to entice a sell-out crowd to the 2023 race, helped by the introduction of a new sprint format featuring standalone qualifying and race sessions on Saturday.
This has followed a return to an April slot on the calendar, with organisers stating that they are happy to be flexible with either April or June dates depending on F1's needs.
"The Baku City Circuit has become a hugely popular venue for Formula 1," said F1 president and CEO Stefano Domenicali.
"It is an incredible circuit which always delivers huge drama, and has played host to some of the most exciting races in recent memory. We are delighted to extend our relationship with the country of Azerbaijan and look forward to continuing our growth together."
Baku has been on the F1 calendar since 2016, having run its first race as the European Grand Prix before transitioning to the Azerbaijan Grand Prix in 2017.
It missed a year in 2020 owing to the COVID pandemic but was reinstated to the calendar the season after.
"We are thrilled to confirm our continued partnership with Formula 1," added Azerbaijan's minister of youth and sports, Farid Gayibov.
"Ever since 2016, the economic, social, and cultural impact of the sport on our city and country has been remarkable. The Azerbaijan Grand Prix is a source of great pride for the whole country and will now continue to inspire and excite our fans for a further three years.
"The past six races have been some of the best and most dramatic in the sport's long history and we look forward to creating more magical moments for F1 fans at home and abroad over the next three years – starting with this weekend.
"Moreover, today's agreement has come during a weekend that sees us hosting a record number of fans from over 100 countries, which only serves to make this moment even more special."