I went to a local bike shop a couple days ago and picked up a road bike. I think I chose the wrong size. I bought a medium size instead of a small. I’m 5’7 and I feel comfortable during the first two hours of riding and then the back of my neck starts hurting. The salesman told me that I have a long torso so I agreed to have a medium bike. Any suggestions to fit my bike better for me? I’m 22 years old and spent a ton of money for my bike and I really want to get the best out of it.
Almost all road bikes have your torso leaning forward to some degree, meaning you have to hold your head up constantly. If you've never ridden a true road bike before, you've probably never had to do that. What's the longest ride you've done on a road bike before this two-hour ride?
Since you didn't mention your hands or arms hurting, you're probably not leaning too far forward. Leaning forward (to get lower and more aerodynamic) can put more weight on your hands and can make your hands, arms, and/or shoulders hurt or go numb after a while, especially if you're not used to doing that.
But since you rode for 2 hours before things started hurting, your bicycle's size probably isn't too far from being correct.
So your sore neck is probably just from doing something for two hours that you're not used to. There's a good chance you just need to ride more and get used to holding your head up.
As you ride more, you may find other fit issues. You may have to get a completely different saddle, and it might take you three or four different attempts before you find a saddle you can ride without discomfort after some period of time. You may find your shoes and/or pedal combination starts making your feet hurt or gives you hot spots (you'll know what a "hot spot" is and why it's called that if/when you get one....). You may find certain brands of shorts have padding that rubs your nether regions raw. As already noted, you might have your hands go numb after a while. Welcome to cycling - that's all a part of it.
But it's important to note that you apparently had NONE of those issues in a two-hour ride, and you seemingly haven't ridden your new road bike for that long ever before. So you're really doing pretty well, and in my opinion you probably don't have to change much, unless you've left something out of your question.
At least not yet...
If you cannot return it you can still modify the setup of your bike. In fact, an incorrect setup could be your problem, not the frame size.
The first thing is to correctly set the saddle height, it is paramount. Then you can move the saddle front and back (within limits), install a seat tube with a different setback and move your cleats back and front (if you use clipless).
Then you can move your handlebars. You can move your shifters on the handlebars (that was crucial on my current road bike!), turn the handlebars up and down slightly, move the step up and down (it is probably at the top in a new bike, though, but check) and buy a shorter (or longer) stem. You can also buy handlebars with a different reach.
There is a lot to play with. A professional bike fit would help, but it is not cheap and is better done before buying a bike. Still, it could help a lot, if you have the money.
You don't say how much you're used to riding for 2+ hours, and on what bike, but a sore neck (especially at the back) may be that you're too low for what you're used to. A shorter (and possibly higher) stem, and/or more spacers under the stem will lift your hands, and you won't have to crane your neck as much. I have certainly found that hand/arm height affects the comfort of my neck.
Another potential issue is transmitted vibrations. Double-wrapping your bars, and better-padded gloves can both help with that.