We only know about the first three years of Harry’s education; after that we don’t know who won the House Cup (or if it was even presented).
Philosopher’s Stone (1991–2)
Gryffindor. Although the points total going into the final feast had Slytherin in the lead, Dumbledore awarded points for the trio’s actions to defeat Quirrell, and Neville’s
“Which means,” Dumbledore called over the storm of applause, for even Ravenclaw and Hufflepuff were celebrating the downfall of Slytherin, “we need a little change of decoration.”
He clapped his hands. In an instant, the green hangings became scarlet and the silver became gold; the huge Slytherin serpent vanished and a towering Gryffindor lion took its place. Snape was shaking Professor McGonagall’s hand, with a horrible forced smile.
— Philosopher's Stone, chapter 17, The Man with Two Faces
This victory was particularly notable because it broke a six-year streak of House Cup victories by Slytherin. (chapter 7, The Sorting Hat).
Chamber of Secrets (1992–3)
Gryffindor. Harry and Ron get awarded a bumper number of points for killing the Basilisk and securing the future of the school:
Harry didn't know whether the best bit was […] his and Ron's four hundred points for Gryffindor, securing the House Cup for the second year running,
— Chamber of Secrets, chapter 18, Dobby's Reward
Prisoner of Azkaban (1993–4)
Gryffindor. It’s only given a cursory mention at the end of the book, but we learn that their Quidditch performance (they won the inter-house Quidditch championship for the first time since Charlie Weasley), they again won the house cup:
Gryffindor House, meanwhile, largely thanks to their spectacular performance in the Quidditch Cup, had won the House championship for the third year running.
— Prisoner of Azkaban, chapter 22, Owl Post Again
Goblet of Fire (1994–5)
Unknown. At the final feast of the year, the hall was decorated in black rather than for the presentation of the House Cup:
The Great Hall was normally decorated with the winning House’s colors for the Leaving Feast. Tonight, however, there were black drapes on the wall behind the teachers’ table. Harry knew instantly that they were there as a mark of respect to Cedric.
— Goblet of Fire, chapter 37, The Beginning
I’m inclined to think that it just wasn’t awarded this year. I think giving it to any house other than Hufflepuff would be inappropriate. On the other hand, the House Cup can’t make up for the loss of Cedric, and I think Dumbledore would be more tactful than to try to offer it as compensation.
Had there not been a death in the school, the House Cup would probably still have been awarded (with an appropriate number of points for Hufflepuff and Gryffindor to reflect Cedric and Harry’s performance in the Triwizard Tournament); the Tournament itself isn’t sufficient reason to cancel the competition.
Order of the Phoenix (1995–6)
Unknown. Harry doesn’t attend the final feast of the year, when the House Cup is usually awarded:
The very last thing he wanted to do was to attend the Leaving Feast. He was worried that Dumbledore would make some reference to him in his speech. He was sure to mention Voldemort’s return; he had talked to them about it last year, after all…
— Order of the Phoenix, chapter 38, The Second War Begins
This means that we don’t have any canonical evidence for who won the House Cup this year.
For this school year, the points system is severely disrupted by the Inquisitorial Squad, who show a distinctly pro-Slytherin bias, and reduce the Gryffindor total to zero by the end of the year. On the other hand, McGonagall awards Harry and his friends about 250 points for their work in the Ministry, so it may have balanced out in the end.
Half-Blood Prince (1996–7)
Unknown. At the end of the book, the Gryffindor hourglass is destroyed:
The giant Gryffindor hourglass had been hit by a curse, and the rubies within were still falling, with a loud rattle, onto the flagstones below.
— Half-Blood Prince, chapter 28, Flight of the Prince
That’s all we really see in this book about the house competition (aside from the usual awarding and removal of a small number of points). But I would guess that
The death of the sitting Headmaster meant that the House Cup wasn't really appropriate. Just as with Cedric two years previously, awarding the House Cup after Dumbledore's death would seem like a fairly crass measure.
Deathly Hallows (1997–8)
Unknown. I'm going to guess that like the previous year, it wasn't awarded.
The death of the sitting Headmaster. And dozens of students. And probably hundreds of other casualties nationwide, and the end of a major war.
Add to this the fact that the school had been run by Death Eaters for most of the year, giving the House Cup a distinctly pro-Slytherin bias, and awarding the House Cup seems like a very insensitive move.