L.R.
This seems excessive for just "missing a friend," even for a child who is shy and was especially attached to his friend. Most children at this age are more resilient than that, and would at least be tempted outside by playing with other kids they already know.
I wonder if this actually is not entirely related to losing his friend and if possibly there is some other stress in his life -- whether something happened to him that you don't know about? Have you been able to question him gently about why he's so anxious? The sudden change into a reclusive, moping child -- and the fact that it's gone on for three whole months -- really sounds like something other than, and more serious than, missing a neighborhood friend.
I would ask his doctor to refer you right away to a therapist or counselor with a lot of experience with kids -- one who does play-based therapy. Explain what's going on and note that you wonder if something else has traumatized him and whether a therapist or counselor can find out what is really going on here.
He may just be extremely sensitive and missing his friend, and nothing else might be going on. But if this IS just about the friend, then your son's reaction seems excessive for his age, and getting a professional to work with him could only help. Go with your gut here-- and don't wait for us on this forum, talk to a professional sooner, not later.
And don't rule out the possibility that he may have physical issues that could be causing the headaches, stomachaches, vomiting -- yes, it could be stress but did the doctor also check his blood sugar; ask you about food dyes and additives (some dyes cause kids to have headaches and stomachaches); ask about allergies; etc.? I would want the doctor to rule those out at least rather than just vaguely saying "it's anxiety." An X-ray won't reveal anything about food, blood sugar or other issues, by the way.