* Seven are shot dead in front of worshippers outside mosque
* Israel kills four Palestinians in Gaza air strikes, wounds 40
* Israeli boy, 4, killed by mortar in stepped up attacks from Gaza
* Netanyahu threatens Hamas "will pay a heavy price" for attack (Adds comments from Israeli PM)
By Nidal al-Mughrabi and Allyn Fisher-Ilan
GAZA/JERUSALEM, Aug 22 (Reuters) - Hamas-led gunmen in Gaza executed 18 Palestinians accused of collaborating with Israel on Friday, accelerating a crackdown on suspected informers after Israeli forces tracked down and killed three senior Hamas commanders.
Israeli Prime Minister Benjamin Netanyahu threatened to escalate the fight against Hamas, vowing the group would "pay a heavy price" after a four-year-old Israeli boy was killed by a mortar attack from Gaza, the first Israeli child to die in the six-week conflict.
Shortly after his remarks, Palestinian officials said Israel had flattened a house in a Gaza City air strike, wounding at least 40 people.
With protesters from rocket-hit southern Israeli communities gathered outside his residence in Jerusalem after the boy's killing, Netanyahu was under pressure to take tougher steps to end the rocket fire.
Israel's military spokesman said another ground war was possible if necessary to stop the rocket fire.
Earlier in Gaza, masked militants dressed in black executed seven suspected collaborators, shooting the hooded and bound victims in a busy square outside a mosque after Friday prayers.
Television footage showed a crowd of young boys gathered where the executions took place moments afterwards, blood still running on the street and bullet casings scattered around.
Those deaths followed the killing of 11 alleged informers at an abandoned police station outside Gaza City, marking the third time this month that Hamas-led operatives have executed people suspected of providing intelligence to Israel.
Al Majd, a website linked to Hamas's internal security service, said "the resistance" - a term for all Palestinian militant groups - had begun an operation dubbed "strangling the necks" to clamp down on anyone collaborating with Israel.
Over the years, Israel has established a network of contacts in the Palestinian territories, using a combination of pressure and sweeteners to entice Palestinians to divulge intelligence.
"They provided the enemy with information about the whereabouts of fighters, tunnels of resistance, bombs, houses of fighters and places of rockets," read a conviction letter posted near those killed at the mosque and signed "The Palestinian Resistance", a term for the Hamas-led executioners.
"The occupation bombarded these areas, killing a number of fighters ... Therefore, the ruling of revolutionary justice was handed upon him," it said.
The Hamas crackdown on suspected collaborators follows the killing of three of Hamas's most senior military commanders in an Israeli air strike on Thursday, an attack that required precise on-the-ground intelligence on their whereabouts.
After the executions, a statement obtained by Reuters from the "Palestinian Resistance" said "a number of" other collaborators had surrendered to the authorities.
Human rights groups denounced the killings. Sarah Leah Whitson, Middle East director at Human Rights Watch, called it a "horrendous abuse."
Raji al-Surani, chairman of the Palestinian Center for Human Rights, demanded the Palestinian Authority and other armed factions "intervene to stop these extra-judicial executions, no matter what the reasons and motives are."
Fighting between Israel and Hamas raged on. More than 80 rockets and mortars shot from Gaza hit Israel. A mortar killed a four-year-old boy at a border collective farm. Another rocket seriously wounded another Israeli in Ashdod in addition to four other people injured in a rocket strike on a synagogue and in Beersheba and Sderot, Israeli police said.
An Israeli military source said Israel had determined that the mortar was fired from a United Nations' school in Zaitoun, a district of Gaza pummelled by Israel earlier in the fighting. The source's remark to Reuters suggested the district or school could be targeted again.
Israeli forces carried out more than 25 air strikes in Gaza on Friday, killing four people and in another strike after darkness fell another 40 people were wounded some of them seriously, a Palestinian health ministry spokesman said.
Israel's military spokesman Brig. Gen. Motti Almoz warned Palestinians in Gaza near weapons stockpiles to leave their homes. "We are intensifying our attacks," he said, adding that Israel was "preparing for possible ground action".
Israel pulled its infantry and armoured corps forces out of Gaza more than two weeks ago after destroying Hamas's network of border infiltration tunnels.
But Netanyahu granted preliminary approval on Thursday for the call-up of 10,000 army reservists, signalling the possibility of heightened military action in Gaza.
Since the conflict began last month, 2,071 Palestinians, many of them civilians, have now been killed and around 400,000 of the enclave's 1.8 million people displaced. Sixty-four Israeli soldiers and four civilians in Israel have been killed. (Writing by Allyn Fisher-Ilan; Editing by Andrew Roche and Susan Fenton)