It comes less than two weeks after one student was killed and another injured in a stabbing in the same borough.
The city Department of Education says police safely recovered the handgun from MS 135/Bronx Park Middle School.
The 13-year old suspect allegedly told a friend he brought the gun because he was being bullied.
No one was injured and parents have been notified.
An investigation is ongoing.