The Norwegian, 48, took over permanently in March 2019, having been put in interim charge when Jose Mourinho departed three months earlier.
He led United to second place in the Premier League last season and the Europa League final, which they lost.
Solskjaer said he was “delighted” at signing the new contract.
“We are more confident than ever that, under Ole’s leadership, we are heading in the right direction,” said United’s executive vice-chairman, Ed Woodward.
“Ole and his staff have worked tirelessly putting the foundations in place for long-term success on the pitch.
“The results of that have become increasingly visible over the past two seasons and we are all looking forward to seeing this exciting team develop further in the years ahead.
“What is especially pleasing is the way this progress has been achieved with a blend of young, homegrown talent and top-class recruits, playing attacking football in the best traditions of Manchester United.”