EXHIBIT 99.4 SECOND AMENDMENT TO SHAREHOLDERS AGREEMENT THIS SECOND AMENDMENT TO SHAREHOLDERS AGREEMENT (the "Second Amendment") is dated as of June 7, 2004, among Carrizo Oil & Gas, Inc., a Texas corporation (the "Company"), J.P. Morgan Partners (23A SBIC), LLC (formerly known as CB Capital Investors, L.P.) ("J.P. Morgan Partners"), Mellon Ventures, L.P., S.P. Johnson IV, Frank A. Wojtek and Steven A. Webster (the "Shareholders"). Capitalized terms used but not otherwise defined in this Amendment should have the meanings given such terms in the Shareholders Agreement dated as of December 15, 1999 by and among the Company and the Shareholders, as amended through the date hereof (the "Agreement"). WITNESSETH: WHEREAS, the Company and the Shareholders desire to amend the Agreement to remove Mellon Ventures, L.P., S.P. Johnson IV, Frank A. Wojtek and Steven A. Webster as Shareholders, Original Founder Shareholders, signatories and parties thereto; WHEREAS, Section 6.1 of the Agreement provides that, subject to certain exceptions, an amendment of the provisions of the Agreement requires the prior written consent of the Company, the Requisite Founder Shareholders and the Requisite Investors; WHEREAS, the undersigned Founder Shareholders hold in excess of 50% of the outstanding shares of Common Stock held by all Founder Shareholders as of the date of this Amendment, and therefore qualify as the Requisite Founder Shareholders; WHEREAS, the undersigned Investors hold in excess of 50% of the outstanding shares of Common Stock held by all Investors as of the date of this Amendment, and therefore qualify as the Requisite Investors; NOW, THEREFORE, the parties hereto, in consideration of the mutual covenants and agreements hereinafter set forth and for other good and valuable consideration, the receipt and sufficiency of which are hereby acknowledged, hereby agree as follows: 1. Effective as of the date hereof, the Agreement is hereby amended to delete Mellon Ventures, L.P., S.P. Johnson IV, Frank A. Wojtek and Steven A. Webster (each, an "Exiting Shareholder") as Shareholders, Original Founder Shareholders and Investors, as the case may be, and as signatories and parties thereto. As a result of this Amendment, any Securities owned by an Exiting Shareholder shall cease to be Shares, and no Exiting Shareholder shall have, from and after the effective date of this Amendment, any rights or obligations under the Agreement. 2. The Company and J.P. Morgan Partners acknowledge that they remain signatories and parties to the Agreement, J.P. Morgan Partners remains an Investor, and the terms of the Agreement, as amended by this Second Amendment, shall continue in full force and effect. 3. Each of the following definitions in Section 1.1 is hereby deleted in its entirety: "Additional CB Capital Director" and "Additional CB Capital Directors;" "Business;" "Committee;" "Competitor;" "Compliance Sideletter;" "Equity Incentive Plans;" "Excluded Securities;" "Existing Shares;" "Founder Shareholders;" "Initial CB Capital Director" and "Initial CB Capital Directors;" "Joinder Agreement;" "Liquidity Opportunity;" "Mellon;" "Minimum Public Float;" "Nonvoting Securities;" "Observer;" "Offered Securities;" "Options;" "Original Founder Shareholders;" "Permitted Transfer;" "Preemptive Offer;" "Preemptive Offer Acceptance Notice;" "Preemptive Offer Period;" "Proportionate Percentage;" "Refused Securities;" "Registration Rights Agreement;" "Regulated Holder;" "Regulatory Problem;" "Requisite Founder Shareholders;" "Sale Notice;" "Significant Shareholder;" "Tag Along Notice;" "Tansferring Shareholder;" "Valuation Procedure;" and "Warrant Agreement." Each of the following definitions in Section 1.1 is hereby deleted in its entirety and is substituted therefor with the following: ""CB CAPITAL" means CB Capital Investors, L.P., a Delaware limited partnership, and any successor thereto, including J.P. Morgan Partners (23A SBIC), LLC. "CB CAPITAL DIRECTOR" and "CB CAPITAL DIRECTORS" have the meanings given to such terms in Section 2.1. "INVESTORS" means, collectively, those persons listed on Schedule I attached hereto under the heading "Investors," and every other Person who hereafter becomes a party to this Agreement as an "Investor." "SHAREHOLDERS" means the holders of Common Stock and the holders of Common Stock Equivalents (including, without limitation, the Warrants), in each case, who are parties hereto, and shall include any other Person who hereafter becomes a party to this Agreement as a Shareholder." All other provisions and definitions contained in Section 1.1 remained unchanged. 4. Section 2.1 is hereby deleted in its entirety and is substituted therefor with the following: "2.1 ELECTION OF DIRECTORS GENERALLY. (a) For so long as the CB Capital owns at least 15% of the Fully Diluted Capital Stock, the Company agrees, with respect to each shareholders meeting at which directors are elected (or action by written consent in lieu of an annual meeting), (i) to propose as nominees for election to the Board at such meeting two individuals designated by CB Capital (each, a "CB Capital Director"), (ii) to include the name of each CB Capital Director in the Company's proxy statement and proxy card solicited on behalf of the Board for such meeting, (iii) to solicit proxies on behalf of each CB Capital Director to the same extent proxies are solicited on behalf of any other nominee by the Board for election to the Board and (iv) to cause the attorneys-in-fact or proxies named in the applicable proxy -2- cards to vote the shares with respect to which proxies are given in the manner directed by such proxy cards. (b) For so long as the CB Capital owns at least 7 1/2% of the Fully Diluted Capital Stock but less than 15% of the Fully Diluted Capital Stock, the Company agrees, with respect to each shareholders meeting at which directors are elected (or action by written consent in lieu of an annual meeting), (i) to propose as nominee for election to the Board at such meeting one CB Capital Director, (ii) to include the name of the CB Capital Director in the Company's proxy statement and proxy card solicited on behalf of the Board for such meeting, (iii) to solicit proxies on behalf of the CB Capital Director to the same extent proxies are solicited on behalf of any other nominee by the Board for election to the Board and (iv) to cause the attorneys-in-fact or proxies named in the applicable proxy cards to vote the shares with respect to which proxies are given in the manner directed by such proxy cards. (c) Notwithstanding anything to the contrary contained herein, the Company shall not be required to propose as nominee for election or otherwise take action to cause the election of any Person under Article II or otherwise who has been removed from the Board for "cause" (as defined in Article 7, Section 2 of the Charter) or who the Board has determined could, if elected, be removed for cause as a result of prior actions or omissions. With respect to any determination of cause hereunder for which a determination is otherwise to be made by the Board, such determination shall require the affirmative vote of all CB Capital Directors other than those CB Capital Directors that the Company has alleged may be removed for cause." 5. Section 2.2 is hereby deleted in its entirety. 6. Section 2.3 is hereby deleted in its entirety. 7. Section 2.4 is hereby deleted in its entirety. 8. Section 2.5 is hereby deleted in its entirety and is substituted therefor with the following: "2.5 VACANCIES. If a vacancy is created on the Board by reason of the death, removal or resignation of any CB Capital Director, then such vacancy may be filled by the remaining directors in accordance with Section 2.1." 9. Section 2.6 is hereby deleted in its entirety. 10. Section 2.7 is hereby deleted in its entirety. -3- 11. Section 2.8 is hereby deleted in its entirety. 12. Section 2.9 is hereby deleted in its entirety. 13. Section 2.10 is hereby deleted in its entirety. 14. Section 3.1 is hereby deleted in its entirety. 15. Article III is hereby deleted in its entirety. 16. Article IV is hereby deleted in its entirety. 17. Article V is hereby deleted in its entirety. 18. Section 6.1 is hereby deleted in its entirety and is substituted therefor with the following: "6.1 AMENDMENT. Except as expressly set forth herein, the provisions of this Agreement may only be amended or waived with the prior written consent of the Company and the Requisite Investors." 19. Article VII is hereby deleted in its entirety and is substituted therefor with the following: "DURATION; TERMINATION The provisions of this Agreement shall terminate upon the first to occur of (A) notice of termination by the Requisite Investors, (B) a Sale of the Company which has been consented to by the Requisite Investors and the consideration received by the Shareholders in connection with such sale consists solely of cash and (C) no Investor owns more than 7 1/2% of the Fully Diluted Common Stock." 20. Section 8.10(b) is hereby deleted in its entirety. 21. Section 8.13(a) is hereby deleted in its entirety. 22. Section 8.14 is hereby deleted in its entirety. 23. Section 8.15 is hereby deleted in its entirety. 24. Exhibit A is hereby deleted in its entirety. 25. Exhibit B is hereby deleted in its entirety. -4- 26. This Amendment shall be governed by and construed in accordance with the domestic laws of the State of New York without giving effect to any choice or conflict of law provision or rule (whether in the State of New York or any other jurisdiction) that would cause the application of the laws of any jurisdiction other than the State of New York except to the extent of internal corporate matters, which shall be governed by the provisions of the applicable law of the State of Texas. This Amendment may be executed in any number of counterparts, and each counterpart hereof shall be deemed to be an original instrument, but all such counterparts together shall constitute but one agreement. IN WITNESS WHEREOF, the parties hereto have executed this Amendment as of the date first written above. COMPANY: Carrizo Oil & Gas, Inc. By: /s/ Paul F. Boling --------------------------------------- Name: Paul F. Boling Title: Chief Financial Officer INVESTOR: J.P. Morgan Partners (23A SBIC), LLC By: J.P. Morgan Partners (23A SBIC Manager), Inc., its general partner By: /s/ Christopher Behrens ---------------------------------- Name: Christopher Behrens Title: Managing Director INVESTORS PRIOR TO EFFECTIVENESS OF THIS AMENDMENT ONLY: Mellon Ventures, L.P. By: MVMA, L.P., its general partner By: MVMA, Inc., its general partner By: /s/ Ronald J. Coombs -------------------------------- Name: Ronald J. Coombs Title: Chief Financial Officer -5- FOUNDER SHAREHOLDERS PRIOR TO EFFECTIVENESS OF THIS AMENDMENT ONLY: /s/ S.P. Johnson IV -------------------------------------------- S.P. Johnson IV /s/ Frank A. Wojtek -------------------------------------------- Frank A. Wojtek /s/ Steven A. Webster -------------------------------------------- Steven A. Webster -6-