Following his good one-day performance against Sri Lanka, Dhoni replaced Dinesh Karthik in December 2005 as the Indian Test wicket-keeper. Dhoni scored 30 runs in his debut match that was marred by rain. Dhoni came to the crease when the team was struggling at 109/5 and as wickets kept falling around him, he played an aggressive innings and was the last man dismissed.Dhoni made his maiden half-century in the second Test and his quick scoring rate (half century came off 51 balls) aided India to set a target of 436 and the Sri Lankans were bowled out for 247.
India toured Pakistan in January–February 2006 and Dhoni scored his maiden century in the second Test at Faisalabad. India were left in a tight spot as Dhoni was joined by Irfan Pathan with the team still 107 away from avoiding a follow-on. Dhoni played his typical aggressive innings as he brought up his maiden Test hundred in just 93 balls after scoring the first fifty in just 34 deliveries
Dhoni followed the century up with some prosaic batting performances over the next three matches, one against Pakistan that India lost and two against England that had India holding a 1–0 lead. Dhoni was the top scorer in India’s first innings in the third Test at Wankhede Stadium as his 64 aided India post a respectable 279 in reply to England’s 400. However Dhoni and the Indian fielders dropped catches and missed many dismissal chances including a key stumping opportunity of Andrew Flintoff (14) Dhoni failed to collect the Harbhajan Singh delivery cleanly as Flintoff went on to make 36 more runs as England set a target of 313 for the home team, a target that India were never in the reckoning. A batting collapse saw the team being dismissed for 100 and Dhoni scored just 5 runs and faced criticism for his wicket-keeping lapses as well as his shot selections.
On the West Indies tour in 2006, Dhoni scored a quick and aggressive 69 in the first Test at Antigua. The rest of the series was unremarkable for Dhoni as he scored 99 runs in the remaining 6 innings but his wicket-keeping skills improved and he finished the series with 13 catches and 4 stumpings. In the Test series in South Africa later that year, Dhoni’s scores of 34 and 47 were not sufficient to save the second Test against the Proteas as India lost the series 2–1, squandering the chance to build on their first ever Test victory in South Africa (achieved in the first Test match). Dhoni’s bruised hands ruled him out of the third Test match.
On the fourth day of the first Test match at Antigua Recreation Ground, St John’s, Antigua during West Indies, 2India’s tour of 006, Dhoni’s flick off Dave Mohammed to the midwicket region was caught by Daren Ganga. As the batsman started to walk back, captain Dravid declared the innings when confusion started as the umpires were not certain if the fielder stepped on the ropes and Dhoni stayed for the umpire’s verdict. While the replays were inconclusive, the captain of the West Indies side, Brian Lara, wanted Dhoni to walk off based on the fielder’s assertion of the catch. The impasse continued for more than 15 minutes and Lara’s temper was on display with finger wagging against the umpires and snatching the ball from umpire Asad Rauf. Ultimately, Dhoni walked off and Dravid’s declaration was effected but the game was delayed, and Lara’s action was criticised by the commentators and former players. Lara was summoned by the match referee to give an explanation of his actions but he was not fined.
Dhoni scored two centuries in Sri Lanka’s tour of India in 2009, a series of three matches in which he led India to a 2–0 victory. With this feat, India soared up to the number one position in Test cricket for the first time in history. India scored 726–9 (decl) in the third match of this series, which is their highest Test total ever.
He played his last series in the 2014–15 season in India’s tour of Australia captaining India in the second and third tests; losing the second and drawing the third, trailing the series 2–0 before the Sydney Test. Following the third Test in Melbourne Dhoni announced his retirement from the format.In his last Test, he effected 9 dismissals (8 catches and 1 stumping), and in the process, went past Kumar Sangakkara in the record for stumpings with 134 (in all three formats combined) and also broke the record for effecting the most dismissals in a match by an Indian wicketkeeper. He finished his last innings unbeaten making 24 runs.