Security officials said the three killed were among a group of six who had taken refuge in a building under construction after they were chased by security patrols late on Thursday night.
A security officer was also wounded in the exchange of fire.
Security forces surrounded the building in Um al-Qura street in the al-Safa neighbourhood in northeast Jidda, called in reinforcements and cordoned off the site.
The besieged men reportedly opened fire from inside the building, provoking the security forces to fire back.
Security forces later stormed the building, capturing a wounded suspect.
The gunbattle came a day after a car bomb targeting a security forces building in capital Riyadh killed at least five people and wounded 145 others.