There was a heavy police presence at Irvine where officers seized a quantity of alcohol.
The 15-year-old was seriously assaulted in the sand dunes area at Irvine Beach Park at around 5pm on Saturday.
He was taken to nearby University Hospital Crosshouse for treatment, where he remains.
Officers are appealing for information about the incident in Ayrshire.
Detective Inspector Stuart Dougan said: “This will have been a very frightening experience for the victim.
“The beach has been very busy this weekend and I would ask any witnesses who were in the area at the time, or anyone with information about the incident, to please get in touch.
“Additional officers are carrying out patrols to provide reassurance as people gather to enjoy the nice weather.”
Anyone with information is asked to contact police on 101 quoting reference 4680 of June or Crimestoppers on 0800 555 111.