But Leinster went on to score a crucial penalty try while Glasgow winger Taqele Naiyaravoro was in the sin bin, before they added a late penalty to make it 23-18.
That was enough to hand the visitors their third defeat in five GUINNESS PRO12 matches this season and Townsend told the Warriors' website: "There was a lot to talk about regarding that game.
"First of all I was impressed with the effort the players put in, especially the Scotland World Cup players who came into the group on Tuesday after what was a very intensive last few months for them.
"A couple of them cramped up and felt it near the end but they really put their bodies on the line for the team.
"I felt there were times in the first half where we played high intensity, attacking rugby and had excellent line speed in defence, putting Leinster under real pressure.
"In the second half, the two yellow cards obviously put us under pressure and meant they could find gaps in our defence.
"We still hung in there after the first yellow card and scored a cracking try through Taqele, after holding on to possession for a number of phases."
He continued: "What we have to do is to make sure that we don't put ourselves in a position where yellow cards could be awarded by a referee as discipline is a key factor in tight games.
"That'll be our focus next week; to first of all make sure we are tough to beat."
To buy tickets for the GUINNESS PRO12 Grand Final click here. Also follow us on Facebook, join the conversation on Twitter, sign up to our YouTube channel for extensive match highlights and sign up for our newsletter for regular updates on the GUINNESS PRO12.