This is the wrong question. We don't keep jobs in this country by preventing them from going elsewhere. That's like trying to make the economy stand still. We keep them here by creating them here.
This is how it has always happened in the past. Otherwise, we would have at least 30% unemployment today, when you consider how many jobs have been lost in the American manufacturing, mining and agricultural economy in the last 50 years. Yet we're not even close to that. We enjoy unprecedented convenience, comfort and health. The same will come in the future as long as Americans continue to produce ideas or supply the means and know-how to put other people's ideas into action.
We have a head start on this because we are so advanced as to have the leisure to keep our eyes open for the next big thing. It's true, there are no guarantees. But it's pointless to try to stop the train by standing in front of it.