All students who were sheltering in place were released when the school lockdown was lifted at 1:22 p.m.
SRPD had over 20 officers on the scene Friday, searching the campus due to a report of a student seen on campus with a handgun.
There were no threats of violence and no one has been injured, police say.
Police said the suspect was formally a student at the high school but was recently suspended.
A detective located the gun in the trash at McDonald's across from Santa Rosa High School, according to a police report.
"The gun is a realistic looking replica firearm with a functioning slide that shoots pellets or bb's," the report said.
Police say the suspect was taken to Santa Rosa Police Department and will be booked into the Sonoma County Juvenile Justice Center for having a weapon on school grounds.
Parents were directed to pick up their children on Ridgway Avenue only by SRPD. Buses picked up in the usual spots and students were allowed to leave in their cars.