Tensions have risen in recent weeks between the EU and Britain ahead of the start of formal Brexit negotiations.
But in a speech to the Irish parliament, he warned Britain's departure from the EU would have "consequences", in particular for Ireland, raising the possibility of customs checks on the border with Northern Ireland.
"If we put things in the right order, if we negotiate with mutual respect, without any kind of aggressivity... and if we are open to finding solutions, there is no reason why our strong Europe cannot maintain a strong relationship with the UK," Barnier said.
But addressing a joint session of the Houses of Oireachtas in Dublin, he hinted at the possible return to customs borders between Ireland and the British province to its north.
The prospect of reinstalling checkpoints has sparked fears for a resumption of tensions in Northern Ireland, which was plagued by decades of violence over British control until the Good Friday peace agreement in 1998.
"I will work with you to avoid a hard border."
But the Frenchman added: "The UK's departure from the EU will have consequences. We have together the duty to speak the truth," Barnier said.
"Customs controls are part of EU border management, they protect the single market, they protect our food safety and our standards.
"But as I already said many times, nothing in this negotiation should put peace at risk, nothing."
He repeated that the border issue was one of his three priorities for the Brexit talks, together with the rights of EU citizens living in Britain and London's exit bill.
"We first must make sufficient progress on these points before we start discussing the future of our relationship with the UK. And the sooner this will happen, the better," he said.
"If the conditions are right, a close partnership with the UK is in everybody's interests."
Tensions have risen in recent weeks between the EU and Britain ahead of the start of formal Brexit negotiations after the British general election on June 8.
Barnier stressed: "I want us to reach a deal. The UK has been a member of the EU for 44 years. It should remain a close partner."