The incident began around 2 p.m. at the Wendy's at Northeast 29th and Sandy Boulevard in Portland.
Police said the man was standing outside the restroom when the boy approached. The man grabbed the child, forced him inside and locked the door.
The child was stabbed several times while he fought back, and the boy's father tried to open the door but had to get the manager to unlock it.
At that point, the man opened the door, shoved the boy outside and then locked himself inside the restroom. Some people who were in the restaurant held the door shut until police arrived.
When officers got there and tried to talk to the man, he claimed he had a gun. Officers backed away and called in negotiators and a tactical response team. After several hours negotiating, the man surrendered to police without further incident.
Police recovered a knife that they believe was used in the assault but did not locate any guns.
The young victim was taken to a local hospital where he underwent surgery and is expected to recover.
Police booked 49-year-old Adam Lee Brown into jail for investigation of attempted murder, assault, sexual abuse, kidnapping, coercion and furnishing false information to a police officer.
Brown, who is a registered sex offender, also had an outstanding arrest warrant for a parole violation.
He is due in court on Monday.