State television said the president was fine, and accused followers of
Sheikh Sadiq al-Ahmar, a prominent tribal leader, of attacking the palace, dpa reported.
Yemen TV said Saleh would hold a press conference in an hour.
However, a Sana'a-based correspondent for broadcaster Al Arabiya said that Saleh had sustained a minor head injury and four of his guards were killed in the attack.
The deputy prime minister and speaker of parliament were among those reported to have been injured inside the mosque.
The palace was hit by two shells, activists said online, as clashes between government forces and opposition tribesmen continued in the capital Sana'a.
Fighting escalated in both Sana'a and the southern city of Taiz on Friday, with two people killed and 20 injured when security forces opened fire on protesters in Taiz.
"Many injured are besieged inside the mosque, and security prevented doctors from helping them," a doctor and activist who has been involved in protests for months told the German Press Agency dpa.
"Taiz has turned into a city of ghosts and war," he said in a telephone interview, during which gunshots could be heard in the background.
He said that both police and army forces have surrounded the city, and were preventing people from leaving or entering.
More than 350 people have been killed since protests began in January.
Also on Friday, security forces shelled the area where the house of al-Ahmar is located, in Al-Hasaba area.
Al-Ahmar is the head of the Hashid tribe, to which Saleh belongs, and supports the widespread protests calling for the president to resign after 32 years in power.
More fighting erupted in different parts of the capital, as security began to target other senior members of the Hashid tribe, including Hamid al-Ahmar's house on Hadda street.
Violence erupted in Sana'a last month after Saleh refused - for the third time - to sign a Gulf-brokered power transfer deal.
Security forces had fired on protesters ahead of a funeral processions held for some 50 people killed over the past few days.
Young men carried the bodies in a mass procession as tens of thousands of protesters gathered in a main street in the capital.
Nationwide protests demanding Saleh's resignation have shaken Yemen for months. The protests have been met with a government crackdown, and efforts at political mediation have repeatedly failed.
As violence drags on and the death toll rises, neither Saleh nor the opposition parties show any signs of wanting dialogue