Despite a shaky start, Schalke settled into the match and went in front in the 44th minute as Matip headed past Faryd Mondragón after a free kick by Lukas Schmitz.
Farfán and Kevin Kuranyi wasted chances in the second half as it looked like Köln still had a lifeline in the match at Veltins-Arena, but the Peruvian put to bed those doubts with nine minutes to go.
Kuranyi made a dash into the Köln penalty area and laid the ball off for Farfán to slot home with ease to keep Schalke right in the title hunt with 12 matches to play.
Köln remain eight points above the drop zone.
BERLIN (AFP) - Third-placed Schalke maintained their title push with a 2-0 win over Cologne on Sunday to put them three points behind leaders Bayer Leverkusen and Bayern Munich.
Joel Matip set Schalke on the right road in first-half injury-time, with Jefferson Farfan ensuring the victory in the 81st minute.
In Sunday's late kick-off, Eintracht Frankfurt defeated SC Freiburg 2-1 with Halil Altintop scoring the decisive goal in the first minute of time added on.
Pappis Cisse had put Freiburg into a 25th-minute lead with Benjamin Kolher levelling before the break.
On Saturday, Bayern Munich stretched their winning run in the league to nine games and 12 overall with a 3-1 victory over Borussia Dortmund to draw level on points with Bayer Leverkusen, who remain top by the slenderest of margins on goal difference -- 30 to 29.
Leverkusen, who have topped the table since October, held onto the lead with a 2-1 home win over reigning champions Wolfsburg.
It was the perfect result for Bayern ahead of their Champions League round-of-16 first leg date with Fiorentina on Wednesday.
Coach Louis van Gaal reflected: "I?m delighted and satisfied about winning, because Dortmund did very well tactically and were extremely aggressive.
"We made a number of individual errors in defence, and that mustn?t happen against Fiorentina in mid-week. We also need much better organisation throughout the team."
Elsewhere on Saturday, former Real Madrid and Manchester United striker Ruud van Nistelrooy was in double form on only his second run-out since joining Hamburg.
The Dutch forward scored in the 75th and 77th minutes to add to Marcus Berg's first-half opener to lift Hamburg to a 3-1 win over Stuttgart that maintained their hold on fourth place.
Down at the foot of the table, Hertha Berlin grabbed a point with a 1-1 draw against mid-table Mainz but remain four points off second-from-bottom side Nuremberg, who lost 2-1 to Borussia Moenchengladbach on Friday.