Lord Sacks has described religion as "the redemption of our solitude" during a parliamentary debate on the role of faith in society.
The chief rabbi, who will retire from his post in less than a year, suggested that while in secular times religion was often misunderstood as "a strange set of beliefs and idiosyncratic rituals", it could be better understood for its teachings about "making sacrifices for the sake of others, through charity".
"Long before these functions were taken over by the state, religious groups, here and elsewhere, were building schools and hospitals and networks of support," he said, referring to Harvard sociologist Robert Putnam's research on the role of faith groups in society.
"Not for a moment do I say that to be good you need to be religious. However, religiosity as measured by attendance at a house of worship turns out to be a better predictor of altruism and empathy than education, age, income, gender or race."
Lord Sacks went on to discuss the "social implications" of religion, for example sustaining the welfare state when the government was unable to do so. And in a remark reminiscent of his criticism last November of Apple's role in the consumer society, he added that religion could "act as a counter voice to the siren song of a culture that sometimes seems to value self over others, rights over responsibilities, getting more than giving, consumption more than contribution, and success more than service to others".
The debate was called by Lord Singh, a Sikh, who said he wanted to counter the fact that "religion today has a bad press", and involved contributions from peers of all faiths. Among those speaking was Labour peer Lord Janner, who spoke of last weekend's Mitzvah day as an example of "the Jewish community's role in society".
"It is a day when the Jewish community comes together to help society, not financially, but by giving our most valuable asset: our time," he said. "The contribution made by religious communities to our society is outstanding and we should recognise and praise their input into our country."
Baroness Neuberger also spoke, urging the government to assess the "broad lack of public understanding of the roles that faith can play in wider society".
The West London Synagogue rabbi added that the government should "consider drawing in people of faith to debates about education for everyone, volunteering for everyone and the need to learn to give and receive."
Responding, Baroness Warsi said: "This Government believe that religion plays a vital role in British society. Not only do we support people in their right to follow a faith if they choose to do so; we also celebrate faith and faith communities' contribution to society."