Top-flight Boro took the lead in the ninth minute as David Nugent headed in debutant Fabio's back post cross.
Cauley Woodrow was denied by Brad Guzan for the hosts shortly after before Julien de Sart inadvertently deflected Scott Malone's strike into his own net.
With penalties looming, Lasse Vigen Christensen turned in Malone's low cross for a place in round three.
The Whites will take on Bristol City in round three.
Fulham manager Slavisa Jokanovic:
"I never had any plan to leave Fulham.
"If I complain about something it is because I want the best for my team, my team-mates, the supporters too and I was very clear what is my opinion about this situation and that is it.
"I am still in the same position and believe we need more people to be stronger in the future."
Middlesbrough boss Aitor Karanka:
"I'm disappointed because I said before the game this trophy is very important for the club.
"I have to apologise to our crowd because they came here midweek and it's an important trophy for this club, we respect this trophy a lot. So this has been difficult."
Match ends, Fulham 2, Middlesbrough 1.
Second Half Extra Time ends, Fulham 2, Middlesbrough 1.
Foul by Matt Smith (Fulham).
Ben Gibson (Middlesbrough) wins a free kick in the attacking half.
Attempt saved. Alex Baptiste (Middlesbrough) header from the left side of the box is saved in the top centre of the goal.
Jesse Joronen (Fulham) wins a free kick in the attacking half.
Foul by David Nugent (Middlesbrough).
Attempt blocked. Julien de Sart (Middlesbrough) right footed shot from outside the box is blocked.
Goal!  Fulham 2, Middlesbrough 1. Lasse Vigen Christensen (Fulham) left footed shot from very close range to the bottom left corner. Assisted by Scott Malone.
Attempt missed. Julien de Sart (Middlesbrough) right footed shot from outside the box is just a bit too high.
Attempt blocked. Julien de Sart (Middlesbrough) right footed shot from outside the box is blocked.
Delay in match Tayo Edun (Fulham) because of an injury.
Second Half Extra Time begins Fulham 1, Middlesbrough 1.
First Half Extra Time ends, Fulham 1, Middlesbrough 1.
Attempt blocked. Sean Kavanagh (Fulham) left footed shot from the right side of the box is blocked.
Attempt saved. David Nugent (Middlesbrough) right footed shot from the left side of the box is saved in the centre of the goal.
Substitution, Fulham. Luca De La Torre replaces Jozabed.
Attempt missed. Matt Smith (Fulham) header from the centre of the box is just a bit too high.
Attempt saved. Jozabed (Fulham) right footed shot from outside the box is saved in the centre of the goal.
Attempt blocked. Adam Forshaw (Middlesbrough) right footed shot from outside the box is blocked.
Foul by Matt Smith (Fulham).
Adam Clayton (Middlesbrough) wins a free kick in the defensive half.
Substitution, Fulham. Matt Smith replaces Cauley Woodrow.
Delay in match Cauley Woodrow (Fulham) because of an injury.
Attempt missed. David Nugent (Middlesbrough) left footed shot from outside the box is just a bit too high.
First Half Extra Time begins Fulham 1, Middlesbrough 1.
Second Half ends, Fulham 1, Middlesbrough 1.
Substitution, Middlesbrough. Cristhian Stuani replaces George Friend because of an injury.
Foul by Ryan Tunnicliffe (Fulham).
Nsue (Middlesbrough) wins a free kick in the attacking half.
Delay over. They are ready to continue.
Delay in match George Friend (Middlesbrough) because of an injury.
Attempt missed. Stewart Downing (Middlesbrough) left footed shot from outside the box is just a bit too high from a direct free kick.
Foul by Dennis Adeniran (Fulham).
Stewart Downing (Middlesbrough) wins a free kick in the attacking half.
Corner,  Fulham. Conceded by Ben Gibson.
Jozabed (Fulham) wins a free kick in the attacking half.
Foul by Daniel Ayala (Middlesbrough).
Substitution, Middlesbrough. Adam Forshaw replaces Viktor Fischer.
Richard Stearman (Fulham) is shown the yellow card for a bad foul.
Championship side Fulham came from behind to knock out Middlesbrough in the EFL Cup second-round.