An 18-year-old woman was allegedly followed by a car on her walk home at about 2am on Sunday, November 21.
The driver stopped on Cecil Avenue in Castle Hill and allegedly sexually assaulted her.
Following an investigation, police arrested a 35-year-old man at a Castle Hill home yesterday.
Police also seized a gun and illegal drugs, as well as other items.
The man was charged with aggravated sexual assault and possessing an unauthorised firearm.
He was refused bail and will appear in court today.