O’Shea earned his first senior cap for the Republic of Ireland on 15 August 2001, when manager Mick McCarthy sent him on as an 84th-minute substitute for Gary Kelly in a friendly against Croatia at Lansdowne Road. His debut ended in disappointment, when he gave away a penalty for handball in injury time, which was scored by Davor Šuker for a 2–2 draw. He was not included in the Irish squad for the 2002 FIFA World Cup. His versatility has earned him a place in the starting eleven. Although played in various positions during last few qualifying campaigns, he has made the defensive slot his own, mainly in central defence with Richard Dunne and at right-back on occasion or filling in for injured players. On 19 August 2003, O’Shea scored his first international goal as he headed in Ireland’s first in a 2–1 home friendly victory over Australia. During the 2010 World Cup qualifying, O’Shea was ever present in the starting line-up for eight of the 10 games. On 1 April 2009, in the game against Italy, he was elbowed in the forehead by Giampaolo Pazzini, who earned the record for the fastest sending off in Italian football history. After receiving treatment for the bleeding, O’Shea continued playing all 90 minutes. Including the second leg of their play-off victory over Estonia, made nine appearances in UEFA Euro 2012 qualifying, as Ireland reached the continental tournament for the first time since 1988. He played every minute of their finals campaign, a group stage elimination after three defeats. On 15 August 2012, his 80th cap, O’Shea captained Ireland for the first time, in a goalless friendly draw against Serbia at the Red Star Stadium in Belgrade. On 15 October 2013, he opened a 3–1 World Cup qualifying victory over Kazakhstan at the Aviva Stadium, his second international goal and the first in over a decade. O’Shea was scheduled to face Spain on 11 June 2013 at Yankee Stadium in New York, but was ruled out of the game over the sudden death of his uncle Jimmy O’Leary. On 14 October 2014, on his 100th cap, O’Shea scored the equalising goal with the last kick of the match, in a 1–1 draw against Germany at Gelsenkirchen, in a Euro 2016 qualifier. In the final qualifier, a 2–1 defeat away to Poland on 11 October 2015, he was sent off for a foul on Robert Lewandowski and thus missed the first leg of the Republic’s play-off. O’Shea was selected in manager Martin O’Neill’s 23-man squad for UEFA Euro 2016 in France. In the absence of Robbie Keane, he captained the Irish in their first two group matches, a 1–1 draw with Sweden and a 3–0 loss to Belgium. He was one of several players who lost their starting place for the decisive final game against Italy, as he and defensive partner Ciaran Clark made way for Shane Duffy and Richard Keogh; the game ended with a 1–0 victory. In the last 16, as Ireland lost 2–1 to the hosts at Parc Olympique Lyonnais, O’Shea entered as a 68th-minute substitute for James McClean. Over a year after his penultimate game for Ireland, O’Shea played his final of 118 matches on 2 June 2018, a 2–1 friendly win over the United States at the Aviva Stadium. After 34 minutes, he was substituted to widespread applause as debutant Darragh Lenihan came onto the pitch. Before the game, he was congratulated by the President of Ireland, Michael D. Higgins, who called him “one of the most inspirational, committed and admired members of our national teams”.