I know exactly how you're feeling right now, and it's going to be just fine. I'm at Cornell myself with a tough major (Biological Engineering with a Mechanical minor) and pre-med to boot if you were wondering where all of what I'm about to say is coming from.
Breathe. One B, regardless of what graduate school or job you apply to, especially in a non-core class, will by no means sink you. If you look at the top schools in the country, the average acceptance GPA is at the most a 3.7-3.8. A 4.0, while fantastic, is not the be all end all indicator of success. The most telling statistic I have seen in my time here was a chart cross-referencing MCAT scores and GPAs in relation to med school acceptances. The highest percentage of acceptances were NOT for those who had a 40+ MCAT and 4.0+ GPA. It was for a lower GPA and MCAT score range.
Does this mean a 4.0 is bad? No. Does it mean that dropping all other things in favor of a 4.0 over a 3.8-3.9 is a bad thing? That's for you to decide. The reason those kids with a 3.8 and slightly lower MCATs got accepted to their top choice more often is that they made the decision to get involved in something besides school. They cultivated friendships, found things on campus they were passionate about, got involved with the community, became a leader, etc. Develop yourself as a person as well as as student.
For the rest of this semester, the best advice I can give you is to work your ass off the next couple weeks. Push for that 4.0, doing everything in your power to succeed. After that though, take a week off from any responsibility and think about what you want to define the next three years of your life. You will, in all likelihood be working until you're 50-60. Think about what you want out of life. If it's a 4.0 above all things and nothing else matters, then by all means, do everything you want to make that happen. I just personally feel like there is more to life than perfect grades.
I personally faced the same crisis you are facing earlier this semester. My goal is to have a 3.85 by the time I leave here, in a college where the average GPA is a 2.7 and the average grade for each class is around a 60 (hooray for curves...kind of). This semester, on my plate I had Organic Chemistry, Organic Chemistry Lab, Physics (Electromagnetism), Differential Equations, Mechanics of Solids, and Thermodynamics: a daunting load. Over winter break I had to decide whether or not to focus solely on my work or do the things I wanted to do, at a possible detriment to my grades. I struggled with the thought and decided I would not let my course load stop me from doing the things I wanted to do. So, this semester, I pledged a social fraternity, was the Public Relations/Inter-Chapter Relations/Regional Delegate for my honors fraternity, was president of my hall council, took a job as a personal trainer, continued playing Varsity Sprint Football, was a member of an organization putting on events for all the dorms, and dedicated one weekend night a week for date night for my girlfriend, regardless of course load. In the end, I can say that I will not have a 4.0 this semester. I will likely end up with a 3.7-3.9 if I bust my ass on finals. I can also say that I would not trade the new friendships, experiences, and personal growth I have experienced for anything in the world, including a 4.0.
The decision is yours. Work hard, achieve to the highest of your potential, but remember that there is going to be a day when you look back on your life in all aspects and think about what you may truly regret when all is said and done. This is something I continue to struggle with every semester, so if you want to talk to someone going through the same thing, PM me.
...after your tests are done
Best of luck!