Video provided by ABC News

A 13-year-old boy has allegedly been raped by a man, 40, in the front yard of his home - after sharing images and personal details with him online.

The alleged attack in suburban north-west Sydney only stopped when his mother ran to her son's aid - with the man running to his car and driving off.

The shocking incident unfolded last Friday after the pair arranged to meet in person using a social media app.

© Provided by Associated Newspapers Limited Detectives from the Child Abuse and Sex Crimes Squad and Blacktown Police Area Command commenced an investigation following a report a teen was assaulted (stock photo) Police allege the man pushed the boy to the ground and sexually assaulted him without consent at about 6.45pm, hours after they made initial contact online.

The boy was taken to The Children's Hospital at Westmead for examination after police were called to the scene.

Detectives from the Child Abuse and Sex Crimes Squad and Blacktown Police Area Command commenced an investigation following a report a teen was assaulted.

Following extensive investigations detectives executed a search warrant at a home at Kellyville Ridge on Sunday, where the man was arrested and taken to Riverstone Police Station.

© Provided by Associated Newspapers Limited A 40-year-old man raped a 13-year-old boy in his front yard after meeting online and sharing images and personal details, police have alleged (stock photo) He was charged with sexual intercourse without consent. He was refused bail and appeared at Parramatta Bail Court on Monday.

He was granted strict conditional bail to appear at Penrith Local Court on Thursday.

Police have urged parents and guardians to speak with their children about staying safe online, particularly during the school holiday period, when they're likely to have more or unrestricted access to the internet.