JeevesVic, this happens to me sometimes when I send a text to a new contact (new meaning someone I have not sent an iMessage to yet on my phone). Either their first message to me or my first outgoing message goes as text, but then will immediately switch to iMessage for subsequent messages.. Doesn't always happens when a send a text to a new person, but every so often.
As for switching back to text, like SeanHRCC said that seems odd for it to do that, unless it is the scenarios he posted above about both parties needing an active internet connection for iMessage to work vs using text. That used to happen to me too every now and then.
In Settings, Messages, I set the option "Send as SMS" to OFF. You may want to try that to see if iMessage is preferred more in your case. I have it off because I iMessage a few international friends and don't want my phone to send a message as text sporadically or when the other party doesn't have internet. Otherwise I will get charged for an international text!
The downside of leaving this option off is that if you need to send a message to someone urgently and they don't have internet, or don't have at&t and are on a call with no wi-fi connected, your message will not deliver to them until they hang up and get their internet connection back up, because it is forcing the use of iMessage. In a case like that, you can tell the message didn't get to their phone since iMessage won't say "Delivered" almost immediately like it usually does. If you need to switch that message back to text, you can touch and hold the message and an option will appear to "send as text". Your phone will resume iMessage whenever possible. Same will happen if you are on a phone call and try send a message to someone (if you have verizon, sprint, t-mobile and are not on wi-fi). Your phone will force the use of iMessage and will not send out the message until you hang out.
This is a rare case I would assume, but good to know in case you turn that option off.
Not trying to get too off-topic, but wanted to list another scenario when you want to definitely turn "Send as SMS" off. When you travel internationally with friends and are in airplane mode with wi-fi on, like at a hotel, etc. We used iMessage to communicate to each other since wi-fi was free at the hotel, but reception was spotty in the rooms. If that option is ON in this case, your phone may try to send as text instead, which won't work of course since you are in Airplane mode. Basically you won't be able to send the message until they get an active connection.
With the "Send as SMS" option turned OFF, you phone will force iMessage. So the recipient will eventually get the message even if they aren't connected to wi-fi, are in a weak, spotty area of the hotel, etc.