Dutchman Van Gaal's contract was due to expire in 2012 but the team have slipped to fifth in the Bundesliga and the two parties agreed in a meeting on Monday that he would depart at the end of the current campaign.
He had extended his contract to 2012 in September.
A 3-1 defeat at Hanover 96 on Saturday was Bayern's third straight loss in all competitions, their worst losing run since 2000.
"Louis van Gaal remains head coach until the end of the season. The original contract ending in 2012 is terminated after both parties agreed to it," Bayern and the coach said in a joint statement.
"The reason for ending the contract (earlier) is the different views on the strategic positioning of the club."
The brief announcement was a far cry from the huge street parties less than a year ago to celebrate the domestic league and cup double, with those titles seen by club bosses as the start of the "Van Gaal era".
The 59-year-old former Barcelona and Netherlands manager, who also coached Ajax Amsterdam to the Champions League title, took charge last season and also steered the Bavarians to the Champions League final which they lost to Inter Milan.
Bayern have failed to replicate that form domestically this season. They are 19 points behind runaway leaders Borussia Dortmund and lost to Schalke 04 in the semi-finals of the German Cup last week.
It was not only on the pitch that Van Gaal failed to deliver. He was also involved in a very public war of words earlier this season with club president Uli Hoeness who called Van Gaal a "one-man show" who never took any advice.
"Our season's targets have been put in question," said Bayern CEO Karl-Heinz Rummenigge. "It is no doubt a very difficult situation but despite parting ways at the end of the season we agreed that we will deploy our joint forces to reach those targets."
Bayern are still in the Champions League, facing holders Inter Milan in Munich next week for the second leg of their last 16 tie. Bayern won the first leg 1-0.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.