So, this means that as more bitcoins are mined, and if bitcoin price keeps growing, a 51% attack is more unlikely because it becomes more expensive right?
More Bitcoins being mined doesn't mean that it would be more susceptible to a 51% attack.
If Bitcoin becomes more expensive, it would be a possibility. They would be able to get a larger profit of fiat if they execute a 51% attack for the same amount of Bitcoins. The main factor affecting the cost of Bitcoin is the network's hashrate. If more people are mining, it is harder for anyone to be able to control 51% of the network as it would require more hashrate and money.
Only if you acquired a majority of the network’s hashing power could you reliably execute such a 51 percent attack against transaction history (although, it should be noted, that even less than 50% of the hashing power still has a good chance of performing such attacks).
https://bitcoin.org/en/developer-guide#term-51-attackIt called too a
Majority Attack.
An attacker that controls more than 50% of the network's computing power can, for the time that he is in control, exclude and modify the ordering of transactions. This allows him to:
Reverse transactions that he sends while he's in control
Prevent some or all transactions from gaining any confirmations
Prevent some or all other generators from getting any generations
The attacker can't:
Reverse other people's transactions
Prevent transactions from being sent at all (they'll show as 0/unconfirmed)
Change the number of coins generated per block
Create coins out of thin air
Send coins that never belonged to him
It's much more difficult to change historical blocks, and it becomes exponentially more difficult the further back you go. As above, changing historical blocks only allows you to exclude and change the ordering of transactions. It's impossible to change blocks created before the last checkpoint.
Since this attack doesn't permit all that much power over the network, it is expected that no one will attempt it. A profit-seeking person will always gain more by just following the rules, and even someone trying to destroy the system will probably find other attacks more attractive. However, if this attack is successfully executed, it will be difficult or impossible to "untangle" the mess created — any changes the attacker makes might become permanent.
https://bitcoin.stackexchange.com/questions/658/what-can-an-attacker-with-51-of-hash-power-doGood to know:The mining pool ghash.io briefly exceeding 50% of the bitcoin network's computing power in July 2014, leading the pool to voluntarily commit to reducing its share of the network. It said in a statement that it would not reach 40% of the total mining power in the future.
This image describe well what is 51% attack:
Source: https://decenter.org/mining/451-51-percent-attack-en