The show doesn't explain this very well, and the reasoning seems to vary as the plot progresses, but the basic idea appears to be that Thawne is the only person who knows
how to safely send Barry back in time to save his mom.
He's only going to help them in exchange for the STAR Labs team helping him.
As long as STAR Labs is giving Thawne what he wants, he has no reason to double-cross them. Plus, as long as Barry is around, there is someone available to fight back if he tries. He convinces them to fulfill his requests, and once it's time, to let him out of his cell. Once Barry
goes through the wormhole, they have to leave it open for him,
and since none of them are fast enough to stop him, Thawne is free to do what he wants.
That appears to be the crux of the deal. Thawne will help them, if they let him out, with everyone knowing that once Barry starts his trip, Thawne's just going to run back home uncontested.
Unfortunately, this breaks down at the end, because Thawne is still in his cell when Barry leaves. Why not just leave him there? Maybe by that point they figured he'd kept up his end of the deal, they may as well just get rid of him, it's not really clear.
It's also interesting that, when Barry comes back, Thawne somehow knows what happened. How did he know, and what did he expect to happen if
Barry had succeeded in saving his mom?