Studying with caffeine sensitivity

I often have trouble sleeping but I have to limit my coffee because it irritates my stomach. I felt better taking a caffeine pill in the morning but when I take one at lunch, it still gives me indigestion even after it wears off. With IBS, carbonated drinks are out of the question, which eliminates most energy drinks. Lots of people depend on caffeine to stick to their study schedule. But if you get side effects from that, what can you do?