To become law, a bill must be passed, in identical form, by both chambers of Congress, during the same Congress that is during the two-year period between congressional elections. At the end of a congress (also called a term), any bill that did not become law (passed by both chambers and signed by the President or any veto overridden) is dead. It may be taken up in a later congress, but it starts again from the beginning of the process.
See Article I, Section 7, Clauses 2 and 3 of the United States Constitution
The comments correctly point out that the constitutional provision cited and linked to above does not specify the rule that a bill must pass both chambers during the same Congress (sometimes called the same term of Congress). I am confident that the rule stated above is correct. I have read news stories about bills that did not pass both chambers "dying" at the end of a Congress, although I have no citations to hand at the moment.
I have spent several hours over the last two days searching the House and Senate websites, reading the House rules, the Senate rules, and Jefferson's Manual. Jefferson's Manual began as notes on parliamentary procedure, made for his own use by Thomas Jefferson during his tenure as Vice-President (1797-1801), based on the then-current procedure of the English Parliament. It is the original basis for the Senate rules. I understand that it is still considered an authority on the procedures of Parliament as they existed in the period 1750-1801.
Jefferson's Manual of Parliamentary Practice section li (a session) (sec 588, page 316), reads:
Parliament have three modes of separation, to wit: by adjournment, by prorogation or dissolution by the King, or by the efflux of the term for which they were elected. Prorogation or dissolution constitutes there what is called a session; provided some act was passed. In this case all matters depending before them are discontinued, and at their next meeting are to be taken up de novo, if taken up at all. 1 Blackst., 186.
[Sec 590, page 317] Congress separate in two ways only, to wit, by adjournment, or dissolution by the efflux of their time. What, then, constitutes a session with them? A dissolution certainly closes one session, and the meeting of the new Congress begins another. The Constitution authorizes the President, "on extraordinary occasions to convene both Houses, or either of them." I. 3. If convened by the President's proclamation, this must begin a new session, and of course determine the preceding one to have been a session. So if it meets under the clause of the Constitution which says, "the Congress shall assemble at least once in every year, and such meeting shall be on the first Monday in December, unless they shall by law appoint a different day." I. 4. This must begin a new session; for even if the last adjournment was to this day the act of adjournment is merged in the higher authority of the Constitution, and the meeting will be under that, and not under their adjournment. So far we have fixed landmarks for determining sessions.
[Sec 592, page 318] When it was said above that all matters depending before Parliament were discontinued by the determination of the session, it was not meant for judiciary cases depending before the House of Lords, such as impeachments, appeals, and writs of error. These stand continued, of course, to the next session. Raym., 120, 381; Ruffh. Fac., L. D., Parliament.
The practice of the English Parliament as set down by Mr. Jefferson seems to be the basis of the current US practice, but I can find no law, nor any provision of the current house or senate rules, explicitly adopting or codifying it, or setting it as a rule for the US.
The official page How Our Laws Are Made has an extensive discussion of the progress of a bill from proposal to law, but nowhere mentions what happens to a bill not agreed to by both chambers.