The San Francisco-based companies did not disclose terms, but a person familiar with the matter said Twitter paid $350 million in stock for MoPub.
The deal has built-in upside for the sellers as it assigned a value of around $20 to Twitter shares, when in fact the microblogging service's shares are trading in the high $20s on the secondary market, the person said.
MoPub allows companies to keep track of ad inventory in real time, similar to what Google can do with DoubleClick.
MoPub's venture backers include Accel Partners, Harrison Metal Capital, and Jafco Ventures.
Twitter is considered a hot initial public offering target for 2014.