Can I take nyquil if I am takening both bactrim (sulfamethoxazole and trimethoprim) and doxycycline for an infection?

Should be ok. While it is most likely fine to take all three medications, you should have your pharmacist check to make sure that the ingredients in the nyquil will not make either antibiotic less or more available in your system.
Yes you can. The nyquil should not interact with the two antibiotics you are taking. But like much else in medicine, caution is always advised. If you have significant adverse reaction to any meds you take, inform your doc/nurse as soon as possible. Good luck.