Market structure and price setting: Imperfect competition in the final good sector I'm looking at an economy with two sectors. The intermediate good is produced under perfect competition and Cobb-Douglas production. 

There is a fixed-cost for producers to enter the final market. Hence, there is a measure of firms that produce here. There is a search friction between consumers and producers, such that ultimately, each consumer will by from one producer only. Final-goods producers produce "on demand" using the intermediate good only, hence, some of them will need more of the intermediate good and some will need less.

This is the first time I'm looking at a market like this. There is a measure of firms in both sectors. This means, there are countably infinitely many firms in both sectors, right? How does this make sense, given that there is perfect competition in one and imperfect competition in the other?

I would like to final sector firms to all pay the same price, despite having different ex-post demands. I guess some sort of insurance prior to period start would take care of that. However, how would then prices be set here?
One solution to this problem is to use monopolistic competition (sometimes called the differentiated goods monopoly) in the final good sector.  For example, households might consume a continuum of final goods, each different, and aggregated with a constant elasticity of substitution utility function. This is the setting in the hugely influential Dixit and Stiglitz  (1977) paper. The approach of Dixit and Stiglitz is heavily used directly or as motivation in new Keynesian modeling because monopoly pricing power allows for sticky prices.