Bluebirds captain Sean Morrison headed the winner to lift them into the top two.
Defeats for Aston Villa and Derby allowed Cardiff to open a two-point gap on the play-off places after their third victory in six matches.
Morrison beat Ben Gibson at the back post to head home Junior Hoilett’s free-kick after 34 minutes.
Boro manager Tony Pulis believes Morrison fouled Gibson in the act of scoring and said: “In the first half, we found it difficult to cope with Cardiff. They are very good at what they do, they have an identity and they play to that identity.
“Set-plays were always going to be important. Looking back at it Morrison was all over Gibson but we didn’t get that decision and that was the decisive moment.
“Cardiff have five or six players over 6ft 3in let alone 6ft, so it was always going to difficult, but I have no complaints.
“We have 14 games to go and we have to put a run together. The pitch was difficult for the players today.
“We had good footballers in the team with Stewart Downing, Grant Leadbitter and Jonny Howson but Cardiff squeezed the life out of us.
“They are second in the league for a reason, they have an identity and they play to it whether you agree with it or not.”
Cardiff manager Neil Warnock set his sights on leaders Wolves.
The 69-year-old is on course for a record eighth promotion to the top-flight and said: “Kevin Blackwell told me we’re now 11 points clear of seventh, but I asked him how far off Wolves we are now.
“That win is as good as it gets. We restricted them to one shot in the first half, had to defend long throws, could have scored more goals but we never make things simple.
“I just think we can get better. We have players coming back from injury, so I can change two or three to give boys a breather. We’re in a good place, but we can get better.
“I’m quite pleased to just tick along. I listened to others talking about Derby and Villa’s credentials, so long may that continue.”
Cardiff City: Etheridge, Ecuele Manga, Morrison, Bamba, Bennett, Paterson (Halford 87), Grujic (Damour 71), Ralls, Hoilett, Zohore, Traore (Peltier 67). Unused substitutes: Pilkington, Mendez-Laing, Murphy, Wildschut.
Middlesbrough: Randolph, Shotton, Ayala, Gibson, Friend, Howson (Harrison 83), Leadbitter, Besic (Assombalonga 62), Downing, Gestede (Bamford 84), Traore. Unused substitutes: Konstantopoulos, Clayton, Cranie, Fry.
Referee: D Bond (Lancashire).