Copy-pasting from various comments I wrote here and there:
As a general introduction, I would recommend you the Introduction to Semantics by T. E. Zimmermann & W. Sternefeld (2013).
They have a very set-theoretical approach, but for formal semantics I guess this is a helpful introduction.
They introduce the basic issues of semantics (lexical, structural and scope ambiguity, compositonality, truth values), explain how to compositionally derive the meaning of complex expressions with some focus on genealized quantifiers and a short excurs to logical types, an introduction to intensionality (not very extensive, but it's good in explaining why we need it and what possible words should be), a chapter on presuppositions (which is usually regarded a concern of pragmatics and therefore more of a bonus to the book, but they try to explain why most in the discussion of presupposition can actually be accounted for purely semantically) and in the end a wrap-up involving predicate logic, lambda expressions and problems of variable bindining, however that chapter is rather dense and probably not most well suited as a gentle introduction to such formal representations. The rest is, I'd say, well readable.
I would NOT recommend Semantics in generative grammar by Heim & Kratzer (1998).
I think it's often used as a textbook in semantics classes and has its focus mostly on the interface between syntax and semantics which is an interesting approach, but IMO there are just too many things that are formally questionable.
I understand not every textbook has to be a Gamut (see below), but if you then still start introducing formal stuff, you should do it properly. You can not just randomly place lambda symbols in a syntax tree and act like you have a formal system now without even properly defining what you are doing.
Also, the book unfortunately doesn't cover intensions, which I think is important to at least have heard of in semantics.
For Montague Semantics, the
Introduction to Montague Semantics by D. Dowty, R. Wall and S. Peters (1981) is proabably the best choice.
This book gives and overview the syntax and semantics of a fragment of English in Montague style including modal logic, tense logic, intensional logic and of course PTQ.
Having said that, if you are interested in Montague semantics, there is no way around reading the original article on The Proper Treatment of Quantification in Ordinary English (PTQ) and maybe also Universal Grammar.
I know that the syntax rules with all these special symbols look complicated at first sight, but the essence of the paper (best exemplified by the well-known unicorn sentences) is an actually quite simple, yet important insight for the study of intensional semantics.
If you are looking for an introduction to logic, I find
Mathematical Methods in Linguistics by B. Partee, A. ter Meulen and R.E. Wall (1990) a very good resource.
It introduces pretty much everything which is relevant in the interface between mathematics and linguistics (excluding statistics), starting with basic logic and set theory, then going into algebra, semantic accounts of English, and lastly grammar formalisms and automata (with close relations to the field of parsing).
There is also Logic, Language and Meaning by L.T.F. Gamut (1991), two volumes (the first one a general logic introduction, the second one focussing on intensions).
I think it's very good for formal logic used in linguistics and it covers quite a lot and in good detail; I like it especially because it is one of the few textbooks that actually provide properly formulated and not just wishy-washy definitions that make you understand what is mathematically actually behind it. I frequently use it to take reliable definitions of basic concepts from.
However, people tend to find it harder to read for beginners, so if you're not already familiar with logic from mathematics or something else, it might be better to start with one of the other books mentioned.
Finally, if you want it a bit more gentle and from a more philosophical point of view, I know about Logic by Winfrid Hodges (1977/2001).
It explains the basic ideas of logic, truth-functional semantics and calculi like natural deduction in a probably "softer" way than, e.g., Gamut, but it is not primarily motivated by linguistics.