Your cost for CGT purposes will be the sum of half the original purchase price paid 14 years ago and whatever you paid your friend to buy him out. Deduct that from the value now to arrive at the potential gain. You are unlikely to exchange contracts to sell the property by 5 April so I shall work on the basis that it is sold after 5 April 2014. The calculations ought to be done using months as opposed to years but I will use years for illustrative purposes.
If you sell the property in May 2014 and make a gain of £60,000, that part of it which is covered by your occupation of the property will be exempt from CGT as will the gain for the last 18 months of ownership. That will account for £15,000 (£60,000 / 14 x 3.5). The remaining gain of £45,000 is split as to £40,714 to that part of the letting period gain not covered by the last 18 months of ownership (£60,000 / 14 x 9.5) and £4,286 to the period of one year when you were not living there but your friend was (£60,000 / 14 x 1). I have assumed the property was let for 11 years to make the number of years of ownership total 14.
As the property was both your main home and it was let you are entitled to letting relief which is the lesser of:
2 the sum of the main residence gain and the gain for the last 18 months of ownership of the property which is £15,000 and
3 the letting period gain of £40,714.
Letting relief of £15,000 will reduce the remaining gain of £45,000 to £30,000 and the CGT exemption of £11,000 will reduce it further to leave a taxable gain of £19,000.
There are two rates of CGT, 18% and 28%. The rate or combination of rates you will pay will be dependent on the level of your income in the tax year of disposal of the property. Assuming you sell the property in the 2014/15 tax year, the following will apply:
1 If your income in 2014/15 including the taxable gain is £41,865 or less, then all the taxable gain will be taxed at 18%.
2 If your income in 2014/15 excluding the taxable gain is more than £41,865, then all the taxable gain will be taxed at 28%.
3 If your income in 2014/15 excluding the taxable gain is less than £41,865 but more than £41,865 when you include the taxable gain, then part of it will be taxed at 18% and part at 28%.
If you exchanged contracts to sell the property by 5 April 2014, you would qualify for exemption for the last 36 months of ownership which would reduce your net taxable gain to £6,142 as the exempt gain and the letting relief would be increased.
As for moving into the property is concerned, that won't necessarily make all the taxable gain go away I'm afraid. You are given the last 18 months of ownership as an exempt period so you would not start to gain anything until each month of occupation after that. It will also be affected by property prices and the tax rules in place at the time of disposal.
If you transferred the property into joint names with your spouse, so long as it continued to be let for a while after your spouse was put on the deeds, you would benefit from an extra CGT exemption of £11,000 which would reduce the 2014/15 taxable gain to £8,000, £4,000 for each of you. In order for a part owner to qualify for letting relief, the property has to be let duing their period of ownership.
Take a look at the HMRC helpsheet HS283 for more information on the main residence and CGT.
I hope this helps but let me know if you have any further questions.