Dozens of residents of Marib had gathered outside the local government offices to demand better jobs for and representation of Yemen's tribes in the state and military.
Police opened fire after the demonstrators refused to disperse, killing two and wounding three others, the source said on condition of anonymity.
A policeman was also killed and four more wounded when an armed protester returned fire, according to the source.
The World Health Organisation estimates more than 8,600 people have been killed and 58,600 injured since March 2015 when a Saudi-led Arab coalition intervened in the war.
The rebels control the capital Sanaa and Yemen's northern highlands, while the city of Marib is held by the Saudi-backed government.
Tribes have joined the fighting on both sides in Yemen, which has a traditionally tribal society and where gun ownership is widespread.