In 2009, Alice and Bob buy 10 shares of Fund A for $100/share. Each has $1,000 basis in the fund.

In 2012, Fund A is worth $200/share. Alice sells her shares of Fund A, realizing a $1,000 capital gain. Because Alice is in the 15% tax bracket, she owes no taxes on this gain. The next day, she repurchases 10 shares of Fund A at the same price (the 'wash sale' rule does not apply).

In 2014, Alice and Bob are now in the 25% tax bracket (15% long term capital gains tax) and sell their shares. Fund A is worth $250/share. Alice has realized another $500 gain, incurring $75 in taxes. Bob has realized a $1,500 capital gain, incurring $225 in taxes.

Bob has incurred triple the taxes on the same capital gain by not tax-gain harvesting.

Fine points about tax gain harvesting

Regulatory

Wash sale: The "wash sale rule" does not apply to tax-gain harvesting. The definition of a wash sale specifically applies it only to securities sold at a loss; securities sold at a profit may immediately be repurchased without tax consequences.

Qualified dividends: If you hold shares less than 61 days and receive qualified dividends from those shares, they are not qualified dividends even though the fund company may claim to be qualified dividends. See Mutual Fund Ordinary Dividends for more details. Disqualification of qualified dividends may outweigh the benefit of tax gain harvesting in some cases.

Operational

Offsetting with capital losses: Carryover losses, and losses realized during the year, must be used to offset realized gains. The tax benefits of these losses may outweigh the benefits from harvesting gains.[note 1]

Tax planning: Utilize tax software or a tax calculator to do "what-if" calculations. Because of the various interactions of the income components and easy-to-make assumptions (incorrect), it is easy to go wrong here if concepts are incorrect; as evidenced by the situations below.[2]

Partial harvesting: If you can only harvest gains on part of your holdings, it is best to harvest gains on the shares with the lowest gains. This gives you more shares with the new, higher basis, and thus more shares which can be sold for reduced gains (if the price rises) or to harvest a loss (if the price falls in a future year).

When not to harvest gains

Income tax rate: The lower capital gains rate only applies to taxpayers who are in the 15% bracket even when the amount of the capital gain is included. A taxpayer with $20,000 in taxable income and $100,000 in unrealized gains would provoke a substantial tax bill by attempting to tax-gain harvest the full amount of their capital gains.

State taxes: If you pay state taxes now to harvest a capital gain, you lose the future growth on that amount. For a long-term investment, you may lose more by not being able to invest the state tax than you save by avoiding federal tax. For example, with a 5% state tax rate, a $1000 harvest costs $50 in state tax, and that $50 could grow to more than the $200 you would owe in state and federal tax if you sell in a higher bracket many years later.

Adjusted Gross Income: To the extent that gain realization will increase reported adjusted gross income (AGI), the higher AGI can reduce available itemized deductions. Certain itemized deductions have percentage AGI thresholds, such as medical expense deductions (greater than 7.5% AGI), and certain miscellaneous deductions (greater than 2% AGI) that will be reduced by a higher AGI.

Social Security: If you are receiving Social Security benefits, any realized capital gain may increase the amount of your Social Security that is taxed. Even if you pay no tax on the gain itself, a $1000 gain may cause $850 of Social Security to be taxed at 15%, a 12.75% tax rate. As more of your Social Security becomes taxable, there is also the possibility that all or part of the capital gain would be pushed into a higher tax bracket. In some cases, this can result in a marginal tax rate of 47.5%.[note 2]

Saver's Credit: Capital gains might cause you to not qualify for the retirement savings credit. Prepare a dummy tax return (including a state tax return) to check for impacts.[3]

Notes

↑The benefits of Tax Loss Harvesting followed by Tax Gain Harvesting (in a later year) are in opposition; they tend to cancel each other out. This does not preclude an investor with carryover losses from Tax Gain Harvesting, but it does raise a red flag for further investigation.
Conversely, if Tax Gain Harvesting is followed by Tax Loss Harvesting (with no prior carryover losses), both strategies are working in concert. After Tax Gain Harvesting, you've raised your cost basis; which makes it easier to harvest losses later. And later losses may be worth more, if your tax bracket or Long Term Capital Gains tax rate is higher.
See: Re: Post-2012 tax gain harvesting, direct link to post.