Numerous research endeavors have focused on the near-infrared (NIR) absorption properties and applications of polymethine dyes. Herein, we synthesize two heptamethine pyrylium dyes, TBCY-5 and TBCY-6, containing 5- and 6-membered, respectively, rings in the pi-conjugated bridge, thus producing NIR dyes with maximum absorption exceeding 1000 nm. The effect of counter anions on the NIR absorption property was examined by exchanging perchlorate (ClO4) anions with bistriflimide (TFSI) anions. TBCY dyes with TFSI possessed good solubility and a high molar extinction coefficient compared to the dyes with ClO4. TBCY-5 and TBCY-6 showed negative solvatochromism, exhibiting a hypsochromic shift of the NIR absorption in polar solvents. Photothermal experiments revealed that TBCY-5 and TBCY-6 were suitable as efficient photothermal materials.