You can easily export your MetaMask account private key when it's required for a Smart Contract function. I know you've heard it a hundred times, but once more won't hurt: Be careful to keep access to the file secure so no one else can get ahold of your wallet.
To do so log into your MetaMask account and click on: <Export Private Key>
Enter your password to prove that you are you:
Download locally as a file by clicking on <Save as File>, then click done: