Local police swiftly ruled out a terrorist attack, characterizing the incident as a "tragic relational drama".
The drama was played out on Saturday evening in the town of Würenlingen, in the canton of Aargau near Zurich, and the shooter was among the dead, local police spokesman Michael Leutpold told a news conference.
All the victims and the gunman were Swiss.
Police said the attacker was a 36-year-old but did not reveal his identity.
He was a father of three but no longer living with his family.
He did not have a gun licence and did not fire with a military weapon, the police spokesman said.
The gunman first went to a house in a residential area and fired on three people, killing a 58-year-old man, his 57-year-old wife and a 32-year-old man.
The older couple were his parents-in-law and the younger man his brother-in-law, police said.
He then went to another house and shot dead a 46-year-old male neighbour, before turning the gun on himself.
The shooter had a record of violence and lived apart from his family in the nearby canton of Schwyz.
In 2007, he was investigated for causing bodily harm and in 2012 he was probed after making verbal threats.
Police had searched his home on April 2nd this year but no firearms were found.
Saturday's attack came after the man's wife and children left the family home and were housed in a shelter.
"The mother and her children are safe," said local police official Markus Gisin.
He said the investigation into the shooting was made difficult by the fact that there "are several crime scenes."
Neighbours had alerted police after hearing gunshots after 11pm on Saturday.
The latest shooting, which follows a similar incident last November, sent shockwaves through the tiny Alpine nation.
"This is not possible, we are after all the richest and happiest country in the world," said the German-language Swiss newspaper Blick.
In a report published late last month, Switzerland was found to have the world's happiest people, sparking a wave of national pride and media fervour with front-page headlines.
Some online commentators attributed the increasing rise in shootings to the proliferation of guns in Switzerland.
According to unconfirmed estimates, there are up to 4.5 million firearms in circulation in the country.
It is one of the world's top countries in terms of the circulation of firearms, after the United States, Yemen and Serbia.