The Penicuik Shopping Centre store will close after a one-day half price sale on Sunday, January 30.
The company said all staff have been offered the opportunity to work at other stores, and also revealed that it hopes to return to the town in the future.
Confirming the closure, a spokesperson for Farmfoods told the Advertiser: “We are very grateful to all customers who chose to shop with us at the branch during its many years of trade.
“All staff have been offered the opportunity to continue their employment at other Farmfoods shops and will be supported in relation to any additional travel costs they might have to do so.
“We hope to be able to trade from new suitable premises in the town in future.”
Midlothian MP Owen Thompson (SNP) described the news as “another blow” to Penicuik town centre as shops struggle to recover from the pandemic, and revealed that he was written to the CEO of Farmfoods.
He said: “I'm disappointed to learn that Farmfoods in Penicuik is to close.
"It is well known as a friendly, affordable shop which is an asset to the town centre, especially appreciated by families with children and many older residents who don't travel in their cars for bigger shops.
"Like many town centres, Penicuik has its challenges in the current climate, with changing shopping habits and the impact of the pandemic, and this will come as another blow.
"I have written to the CEO of Farmfoods George Herd about the decision and was reassured that staff were being offered jobs in other shops after Penicuik's closure, although this may not be practical for everyone.
"I also welcome the intention to trade again in the town in future, if suitable premises are found.
"In the longer term I will be speaking to the council and other stakeholders to discuss what more can be done to help prevent further closures and begin to regenerate our local high streets, the beating heart of any community.”