Two men have been charged over a break-in during which a man was shot in the back in Sydney's west overnight.

The victim was arrested after being found with four gunshot wounds.

Three men, including the 37-year-old owner of the semi-rural property, were also arrested at the scene.

Two of the men - a 26-year-old and a 31-year-old - were charged with aggravated break and enter with intent to steal and will face Penrith Local Court late today.

Emergency services were called to a house at Rickards Road in Castlereagh just before midnight.

They found the man in the front yard with gunshot wounds to his back.

He was taken to hospital and placed under police guard.

The owner of the home and two other men were also arrested.

Inspector Grant Healey says it was a dangerous situation.

"At the time of the shooting there were a number of residents at home, including children," Inspector Healey said.

Inspector Healey says at least two other men fled in a small silver-coloured sedan.

Police are appealing for witnesses who may have seen the car on Rickards road between 11:45pm and midnight.

Anyone who sees a vehicle fitting the description is being urged not to approach it but report it to police.

Drive-by attack

It was the second shooting in Sydney last night, after a man was shot in the arm in a drive-by shooting.

Several shots were fired from a car as it drove along Boomerang Road in Edensor Park in Sydney's south-west.

One bullet was found lodged in a nearby house.

Police believe the shooting was targeted.