Dogfish Head Brewery and The Boston Beer Co. — the maker of Samuel Adams Boston Lager — announced Thursday that they have reached an agreement to merge. The deal, which is expected to close late in the second quarter of this year, is valued at about $300 million in cash and stock.

The companies' founders say the merger is going to help the craft brewers compete in an industry that is seeing rapid consolidation. Industry giants have been acquiring smaller breweries. For example, AB InBev (Anheuser-Busch) now owns Goose Island Beer Co. and Golden Road Brewing.

"More than a dozen of our peers have sold to international conglomerates, others have come together through platforms bringing a handful of craft breweries together in roll-ups," the founders of Dogfish Head, Sam and Mariah Calagione, said in a statement. "While neither of those strategies appealed to us, we did realize that Dogfish Head would be a stronger company with the support of our friends at Boston Beer, and vice-versa."

Boston Beer founder Jim Koch says he found a kindred spirit in Sam Calagione. "Just as important as our passion for brewing is our commitment to championing and preserving the independent, American craft movement," he wrote.

Koch founded his company in 1984, and since then it has grown to include brands such as Angry Orchard Hard Cider, Twisted Tea and Truly Hard Seltzer. Dogfish Head, which is based in Delaware, opened 23 years ago and is known for its IPAs and sour beers, often brewed with unusual ingredients.

The companies are both defined as craft brewers by the Brewers Association, meaning they are independent and produce fewer than 6 million barrels of beer each year. In 2018, Boston Beer Co. was the second-largest craft beer company in the country by sales volume, while Dogfish Head was 13th.

The companies say they will retain their status as independent craft brewers.

In a statement, the companies said that Dogfish Head is expected to sell nearly 300,000 barrels this year, which would signal "high single digit growth versus the prior full year." Boston is projecting that the "transaction will be neutral to slightly accretive in 2019 and will not have a material impact on full-year 2019 earnings per diluted share."

Sam and Mariah Calagione will take nearly all of their proceeds from the merger — an estimated $128 million — in stock of the combined company, and Sam Calagione will join the board of directors of Boston Beer in 2020. The Dogfish Head shareholders are expected to receive $173 million in cash. The merged company is going to be led by the current CEO of Boston Beer, Dave Burwick.