The England skipper will also miss the national team's two friendlies against the Republic of Ireland at Wembley on May 29 and Brazil on June 2.
Gerrard will go under the knife later this week and is expected to return in time for Liverpool's pre-season programme.
Gerrard, 33 later this month, has had his best season fitness-wise and his appearance in 220th Merseyside derby was his 36th consecutive Premier League start - equalling his previous longest run set between April 2006 and April 2007.
He has played with the shoulder injury for several months but after an early collision with Everton midfielder Leon Osman on Sunday he looked in obvious discomfort.
However, it did not prevent him completing 90 minutes - Gerrard has missed only 17 minutes of the league season after being forced off against Newcastle just over a week ago after feeling some pain in the shoulder - and putting in another impressive performance.
But with little to play for in their remaining two matches at Fulham and QPR Liverpool have decided it makes more sense for Gerrard to have an operation now to give him an additional couple of weeks' rehabilitation.
"Liverpool have confirmed Steven Gerrard will undergo surgery on a recurrent shoulder problem this week," said a statement from Liverpool.
"The captain's injury has progressively worsened in recent weeks and requires an operation to cure it.
"Gerrard will now miss the final two games of 2012-13, but he is expected to be fit for the start of pre-season training this summer."
- Sports & Recreation
- Steven Gerrard