Rami, 29, joined Milan from Spanish side Valencia last year but made just 18 Serie A appearances for the Rossoneri in the 2014-15 campaign and was keen to leave the Italian club this summer.
A statement from Sevilla read: “Sevilla has reached an agreement with AC Milan over the transfer of Adil Rami pending a medical.
“The player will undergo a medical next week once he returns from his holidays. Should all go well, Rami will sign a contract with Sevilla for four seasons.”
If Rami’s transfer is completed, he will work again under coach Unai Emery.
Emery coached Rami in the 2011-12 campaign at Valencia before the Spanish tactician departed to Spartak Moscow.
Rami had been a reported target of Manchester United and Lyon but has opted to return to Spain.