What is the best way to encrypt and decrypt a variable in Solidity so only the msg.sender and contract can see that variable?
Practical answer: You can't. If the contract can see it when it executes, everyone who has the blockchain can see it.
Theoretical answer that won't help you: Homomorphic encryption. See Can smart contracts compute on encrypted data?