The Red Devils finished third in Group F with four points behind group winners Morocco and runners up Croatian.
Manchester United came from behind twice to hammer Aston Villa 4-2 at Old Trafford.
Manchester United defeated Sheriff 3-0 to keep the hope of top place finish alive.
Manchester United had not won successive games in the league since February.
The German will however stay with the Red Devils as consultant on part-time basis.
English side Manchester United has reached reached an agreement to sign French defender Raphaël Varane from Real Madrid.
United will face Premier League side West Ham in the fifth round of the FA Cup.