Speculation had been linking the Imps boss with the vacancies at Peterborough and Notts County.
Interim chairman Steff Wright said "We're very pleased and we think it's the right time to make the announcement.
"Keith has got a massive job to do in Cardiff and then in terms of putting his squad together for next season."
The manager, who has led his side to the League Two play-offs for the last three seasons, believes the Imps are a club who are going places.
Alexander said: "It wasn't a difficult decision to make. We can now push this club forward."